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 logging | |
| import pickle | |
| import os | |
| import shutil | |
| import sys | |
| import time | |
| PROTOCOL = 0 #keep as ascii for now for debug funsies |
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
| //tabs | |
| require("new-tabs.js"); | |
| //webjumps | |
| define_webjump("youtube", "http://www.youtube.com/results?search_query=%s&search=Search"); | |
| define_webjump("l", "http://dict.leo.org/ende?search=%s"); | |
| define_webjump("hoogle", "http://www.haskell.org/hoogle/?hoogle=%s"); | |
| define_webjump("hg", "http://www.google.com/codesearch?hl=en&q=lang%3Ahaskell+%s"); |
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
| ## | |
| ## Put me in ~/.irssi/scripts, and then execute the following in irssi: | |
| ## | |
| ## /load perl | |
| ## /script load notify | |
| ## | |
| use strict; | |
| use Irssi; | |
| use vars qw($VERSION %IRSSI); |
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
| let list = (cons 1n (cons 1n nil)), | |
| nextfib = λ l. (cons (putNat (addN (head l) (head (tail l)))) l) | |
| in | |
| (putNat (head (iterate 25n nextfib list))) |
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
| sumseries f a b = sum[f n|n<-[a..b]] | |
| data Σ a = Σ (a -> a) a a | |
| instance (Show a, Num a, Enum a) => Show (Σ a) where | |
| show (Σ f a b) = show $ sumseries f a b |
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
| let zero = λ f x. x, | |
| succ = λ n f x. (f (n f x)), | |
| pred = λ n f x. (n (λ g h. (h (g f))) (λ u. x) (λ u. u)) | |
| in | |
| let one = (succ zero) in | |
| let two = (succ one) in | |
| let three = (succ two) in | |
| let four = (succ three) in | |
| let five = (succ four) |
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
| divides k n = rem n k == 0 | |
| sieve :: [Integer] -> [Integer] | |
| sieve [] = [] | |
| sieve (0:xs) = sieve xs | |
| sieve (1:xs) = sieve xs | |
| sieve (x:xs) = x : sieve (removeMultiplesOf x xs) |
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
| type Zipper a = ([a], a, [a]) | |
| fibs = ([1,1,2,3,5], 8, [13,21]) :: Zipper Int | |
| left (xs, y, (z:zs)) = (y:xs, z, zs) | |
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
| #!/usr/bin/env python | |
| import curses | |
| import signal | |
| import traceback | |
| import time | |
| DIGIT_WIDTH = 5 | |
| DIGIT_HEIGHT = 5 | |
| DIGIT_SPACING = 2 |
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
| (add-command "leave-memo" (lambda (bot args sender channel) | |
| (multiple-value-bind (recipient memo) | |
| (split "\\s+" args :limit 2) | |
| (progn | |
| (add-memo recipient memo) | |
| (send-msg bot channel (format nil "tada! Added memo for ~A" recipient)))))) | |
| (add-command "get-memo" (lambda (bot args sender channel) | |
| (send-msg bot channel (format nil "memo for ~A: ~A" args (get-memo args))))) |
OlderNewer