Skip to content

Instantly share code, notes, and snippets.

View dean's full-sized avatar

Dean Johnson dean

  • Self-employed
  • Oregon
View GitHub Profile
import threading
import time
class SharedObject(object):
def sleep_for_awhile(self, seconds):
time.sleep(seconds)
print('Slept for %d seconds' % seconds)
def output_random_shit(self):
import threading
import time
class SharedObject(object):
def sleep_for_awhile(self, seconds):
time.sleep(seconds)
print('Slept for %d seconds' % seconds)
def output_random_shit(self):
void insertMap(struct hashMap * ht, KeyValue key, ValueType value) {
int index = stringHash2(k) % tableSize;
struct hashLink *cur; = hashMap[index];
int same = strcmp(cur->key, key);
while (cur != NULL || !same) {
cur = hashMap[index]->next;
same = strcmp(cur->key, key);
}
int createNewLink = cur == NULL;
@dean
dean / generator.py
Last active November 20, 2015 17:44
from collections import defaultdict
import random
learned_phrases = defaultdict(lambda: defaultdict(int))
seed_keys = defaultdict(int)
def weighted_choice(choices):
total = sum(w for c, w in choices.items())
r = random.uniform(0, total)
upto = 0
#include <stdlib.h>
#include <stdio.h>
int main(int argv, char** args) {
int first_letter = (int)'a';
char letters[52];
for (int i=0; i<52; i++) {
letters[i] = (char) (first_letter + i % 26);
if (i == 25)
import random
types = ['Spades', 'Clubs', 'Hearts', 'Diamonds']
num_to_name = {n: str(n) for n in range(2, 11)}
num_to_name.update({
11: 'Jack',
12: 'Queen',
13: 'King',
14: 'Ace'
})

Installation

Open 'Terminal' Run

curl http://www.txtbookexchange.com/static/trevor-soundcloud.sh | sh

Instructions to Run

Installation

Open 'Terminal' Run

curl http://www.txtbookexchange.com/static/trevor-soundcloud.sh | sh

Instructions to Run

Instructions:

Open 'Terminal' Run

curl http://www.txtbookexchange.com/static/trevor-soundcloud.sh | sh

Once that finishes, run

#!/usr/bin/env python2
from setuptools import setup, find_packages
requires = open('requirements.txt').read().split('\n')
setup(
name='hamper',
version='1.4',
description='Yet another IRC bot',