Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am orblivion on github.
  • I am ill_llogic (https://keybase.io/ill_llogic) on keybase.
  • I have a public key whose fingerprint is D053 23BE 2C75 094F 7BA0 17A7 01B0 AEB6 46A0 DF80

To claim this, I am signing this object:

data Purse a b c = Purse a b c
data Keys = Keys
data Phone = BlackBerry | IPhone | Android
data Wallet = LeatherWallet Float | MoneyClip Float
addKeys (Purse () b c) keys = Purse keys b c
addPhone (Purse a () c ) phone = Purse a phone c
addWallet (Purse a b ()) wallet = Purse a b wallet
from copy import copy
# allCombinations looks for these to know where there are multiple possibilities
class oneOf(object):
def __init__(self, *options):
self.options = options
# signifies that the element shouldn't be there at all. Don't add it to the list,
# the key shouldn't be there, the attribute shouldn't be there, and so forth.
class leaveOut():
import imaplib
import getpass
import re
import webbrowser
import sys
mail = imaplib.IMAP4_SSL('imap.gmail.com', 993)
pw = getpass.getpass() # get password
mail.login('example@gmail.com',pw)
import twitter, re, datetime, PyRSS2Gen
def getURLs(text):
url=unicode(r"((http|ftp)://)?(((([\d]+\.)+){3}[\d]+(/[\w./]+)?)|([a-z]\w*((\.\w+)+){2,})([/][\w.~]*)*)")
return [a.group() for a in re.finditer(url,text)]
def mkFeedItem(url):
return PyRSS2Gen.RSSItem(
title = "Twitter Link",
/* Loads the Google data JavaScript client library */
google.load("gdata", "1");
function summary(str, maxlen) {
if (str.length > maxlen)
return str.substring(0, maxlen-1) + "...";
else
return str
}
@orblivion
orblivion / gist:057fc395e4d87af97fba
Last active August 29, 2015 14:16
Recursive lazy fibonacci
from itertools import izip, islice
def fibg():
"Generate an infinite amount of fibonacci numbers"
yield 1
yield 1
offset = fibg()
offset.next()
for x, y in izip(offset, fibg()):
yield x + y
pub 4096R/8977C0AC 2013-08-31 [expires: 2014-08-20]
Key fingerprint = 9F2E 8AD5 B382 B7CE 1028 524D AB6E 81FF 8977 C0AC
uid Daniel Krol <orblivion@gmail.com>
sub 4096R/0B2BBEEC 2013-08-31 [expires: 2014-08-20]
==========================================================================
pub 4096R/46A0DF80 2014-06-21 [expires: 2016-06-20]
Key fingerprint = D053 23BE 2C75 094F 7BA0 17A7 01B0 AEB6 46A0 DF80
uid Daniel Krol (Main) <orblivion@gmail.com>
pub 4096R/8977C0AC 2013-08-31 [expires: 2014-08-20] pub 4096R/46A0DF80 2014-06-21 [expires: 2016-06-20]
Key fingerprint = 9F2E 8AD5 B382 B7CE 1028 524D AB6E 81FF 8977 C0AC Key fingerprint = 9F2E 8AD5 B382 B7CE 1028 524D AB6E 81FF 8977 C0AC
uid Daniel Krol <orblivion@gmail.com> uid Daniel Krol <orblivion@gmail.com>
sub 4096R/0B2BBEEC 2013-08-31 [expires: 2014-08-20] sub 4096R/0B2BBEEC 2013-08-31 [expires: 2014-08-20]
=======================================================================================================================================================
pub 4096R/46A0DF80 2014-06-21 [expires: 2016-06-20] pub 4096R/46A0DF80 2014-06-21 [expires: 2016-06-20]
Key fingerprint = D053 23BE 2C75 094F 7BA0 17A7 01B0 AEB6 46A0 DF80 Key fingerprint = D053 23BE 2C75 094F 7BA0 17A7 01B0 AEB6 46A0 DF80
uid Daniel Krol (Main) <
subscribeSink_ fun =
awaitForever $ (\x ->
case decode (L.fromStrict x) of
Just (SubscribeResponse (resp, _)) -> do
_ <- liftIO $ mapM (onMsg subOpts . fun) resp
return ()
Nothing ->
return ())
subscribeSink = subscribeSink_ id