- ffffff-ffff, fff f fffffff
- ffff FFFF ffff FFFF ffff FFFF
- FFFFFFFFFF
- F
- fF
- fffff, fffff, fffff, F
- #ffffff
- #FFFFFF
- #fff
- #FFF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
# http://docs.python.org/2/library/time.html#time.sleep | |
while True: | |
bla() | |
time.sleep(0.005) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
-- This one works, but is terribly slow. | |
-- Make it faster!!! | |
step (my, mx) (y, x) = if my == y && mx == x | |
then 1 | |
else stepY + stepX | |
where | |
stepY | y < my = step (my, mx) (y+1, x) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void count_freq(int *number, int number_length) { | |
int *freqs[MAX], *p1; | |
// Nollställ först | |
for(p1=freqs; p1 < freqs + MAX; p1++) { | |
*p1 = 0; | |
} | |
for(p1=number; p1 < number + number_length; p1++) { | |
freqs[*p1-1]++; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
from bs4 import BeautifulSoup | |
from Cookie import SimpleCookie | |
import requests | |
url_template = u'http://wiki.sverok.se/w/index.php?title={}&action=edit' | |
with open('cookie.txt') as fh: | |
cookies = {k : v.value for k,v in SimpleCookie(fh.read()).items()} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import qualified Data.Vector as V | |
steppingPrimeGenerator :: (V.Vector Int, Int) -> (V.Vector Int, Int) | |
steppingPrimeGenerator (ps, x) | V.null $ V.filter ((==0) . (mod x)) ps = (V.snoc ps x, succ x) | |
| otherwise = (ps, succ x) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
li = [...] | |
try: | |
while True: | |
c = li.next() | |
if condition(c): | |
break | |
except StopIteration: | |
# Not found... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE NoMonomorphismRestriction #-} | |
-- If we aren't careful, the monomorphism restriction will bite our backs. | |
module Magic where | |
magic :: (Monad m) => Int -> Int -> m Int | |
magic a b = return $ a + b | |
main = magic 7 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
O | |
-|- | |
||| | |
||| | |
- | |
||| | |
| | | |
- - | |
http://www.youtube.com/watch?v=vTnSf8OjYQ0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Lets build a dictionary of people, like this: | |
names = [u'{} {}'.format(f.lower(),e.lower()) for (f,e) in Participant.objects.values_list('fname', 'ename').order_by('fname', 'ename')] | |
autocompletion_tree = defaultdict(list) | |
for (i,n) in enumerate(names): | |
s = '' | |
for c in n: | |
s += c | |
autocompletion_tree[s].append(i) | |
# Purge it! |