Skip to content

Instantly share code, notes, and snippets.

import logging
import pickle
import os
import shutil
import sys
import time
PROTOCOL = 0 #keep as ascii for now for debug funsies
//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");
##
## 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);
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)))
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
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)
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)
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)
#!/usr/bin/env python
import curses
import signal
import traceback
import time
DIGIT_WIDTH = 5
DIGIT_HEIGHT = 5
DIGIT_SPACING = 2
(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)))))