Skip to content

Instantly share code, notes, and snippets.

@thisiswei
thisiswei / wiki-100k.txt
Last active August 29, 2015 12:19 — forked from h3xx/wiki-100k.txt
Wictionary top 100,000 most frequently-used English words [for john the ripper]
#!comment: This is a list of the top 100,000 most frequently-used English words
#!comment: according to Wiktionary.
#!comment:
#!comment: It was compiled in August 2005 and coalesced into a handy list for
#!comment: use in John the Ripper.
#!comment:
#!comment:
#!comment: Pull date: Sun Jan 15 22:03:54 2012 GMT
#!comment:
#!comment: Sources:
def append(val, p):
last = p[-1]
p[-1] = val
insert(-1, last, p)
def insert(idx, val, iterable):
tmp = None
if idx < 0:
idx = len(iterable) + idx
for j, item in enumerate(iterable):
#include <stdio.h>
#include <stdlib.h>
char* CensorString1(char t[], char r[]) {
char *newT;
int i, j, k, occured;
i = j = k = 0;
for (i = 0; t[i] != '\0'; i++){
occured = 0;
for (j = 0; r[j] != '\0'; j++) {
class Node(object):
def __init__(self, val):
self.val = val
self.left = None
self.right = None
def __str__(self):
s = ''
if self.left is not None:
s += str(self.left)
@thisiswei
thisiswei / richhickey.md
Last active August 29, 2015 14:27 — forked from prakhar1989/richhickey.md
richhickey.md

Rich Hickey on becoming a better developer

Rich Hickey • 3 years ago

Sorry, I have to disagree with the entire premise here.

A wide variety of experiences might lead to well-roundedness, but not to greatness, nor even goodness. By constantly switching from one thing to another you are always reaching above your comfort zone, yes, but doing so by resetting your skill and knowledge level to zero.

Mastery comes from a combination of at least several of the following:

@thisiswei
thisiswei / fly.py
Created September 12, 2015 02:48
get flights
'''
pip install pprint
pip install utensil
pip install requests
script for grabbing deals from here: http://content.flyfrontier.com/ways-to-save/online-deals
i.e., get deals flying out of Denver and flying back to LGA or PHL:
python /tmp/tmp6.py --console --o=DEN --d=LGA,PHL
@thisiswei
thisiswei / pgessays.py
Created November 24, 2012 22:32 — forked from olasitarska/pgessays.py
Builds epub book out of Paul Graham's essays.
# -*- coding: utf-8 -*-
"""
Builds epub book out of Paul Graham's essays: http://paulgraham.com/articles.html
Author: Ola Sitarska <ola@sitarska.com>
This script requires python-epub-library: http://code.google.com/p/python-epub-builder/
"""
import re, ez_epub, urllib2, genshi
files = file('54.txt').readlines()
hands = [h.replace('\n','') for h in files]
def result():
dicts = {0:0, 1:0}
for i in range(1000):
h1, h2 = split_hand(hands[i])
dicts[who_won(h1,h2)] +=1
return dicts
def pascal(n):
if n == 1:
return [1]
else:
x = pascal(n-1)
return [1] + [x[i]+x[i-1] for i in range(1,len(x))] + [1]
" seems like learning functional language is helpful :) "
@thisiswei
thisiswei / frequency.py
Last active December 12, 2015 07:58
frequency
from collections import Counter
from collections import defaultdict
def frequency1(lst):
return [(lst.count(s), s) for s in set(lst)]
def frequency2(lst):
return dict((s, lst.count(s))
for s in set(lst))