Skip to content

Instantly share code, notes, and snippets.

View Sourceless's full-sized avatar

Laurence Pakenham-Smith Sourceless

View GitHub Profile
@Sourceless
Sourceless / keybase.md
Created June 27, 2017 18:46
keybase.md

Keybase proof

I hereby claim:

  • I am sourceless on github.
  • I am sourceless (https://keybase.io/sourceless) on keybase.
  • I have a public key whose fingerprint is 11EB 27D5 F80E 625B C383 0AB3 3D9D D96A 0340 667C

To claim this, I am signing this object:

@Sourceless
Sourceless / gist:6686811
Last active December 23, 2015 19:59
Langwith Computer Club (LCC)

Aims:

  • Provide a first point of contact for computer science students and computer enthusiasts in Langwith college
  • Run small-scale social events based on usual group interests (video games, movies, etc.)
  • Provide an open community for members to communicate, aid one another, learn, and get feedback on their work
  • Promote excellence through self- and club-guided learning and competition
  • Firmly set Langwith's reputation as a premier CS college

Working with HackSoc:

def columns(list_of_lists):
# Assumes all lists are same length as first, or longer
columns = len(list_of_lists[0])
list_of_lists = [iter(list_) for list_ in list_of_lists]
for _ in xrange(columns):
yield [list_iter.next() for list_iter in list_of_lists]
@Sourceless
Sourceless / ohaiserv.py
Created July 24, 2013 14:05
Server for Hayashi's OHAI protocol
import BaseHTTPServer
class OhaiHandler(BaseHTTPServer.BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200, 'OHAI')
self.end_headers()
self.wfile.write('OHAI')
if __name__ == '__main__':
@Sourceless
Sourceless / gist:6065182
Last active December 20, 2015 03:39
Stupidly bad python function importy thing
# Disclaimer: this is terrible and bad.
# Directory structure:
# bin/
# fragman/
# __init__.py
# fragments/
# __init__.py
# some_awesome_func.py
#
#
@Sourceless
Sourceless / gist:6041235
Created July 19, 2013 18:18
Simple send-me-a-text script
from twilio.rest import TwilioRestClient
import sys
account_sid = 'my-account-sid'
auth_token = 'my-auth-token'
client = TwilioRestClient(account_sid, auth_token)
message = client.sms.messages.create(body=sys.argv[1],
to="my-number",
from_="twilio-number")
@Sourceless
Sourceless / gist:6041228
Created July 19, 2013 18:17
Simple text-me twilio script
from twilio.rest import TwilioRestClient
import sys
account_sid = 'my-account-sid'
auth_token = 'my-auth-token'
client = TwilioRestClient(account_sid, auth_token)
message = client.sms.messages.create(body=sys.argv[1],
to="my-number",
from_="twilio-number")
@Sourceless
Sourceless / gist:5875973
Created June 27, 2013 12:15
Simple Twilio API send-a-text script
from twilio.rest import TwilioRestClient
import sys
account_sid = 'your-account-sid'
auth_token = 'your-auth-token'
client = TwilioRestClient(account_sid, auth_token)
message = client.sms.messages.create(body=sys.argv[1],
to="your-number",
from_="your-twilio-number")
class cons:
"""A LISP-like cons cell, composed of two items."""
def __init__(self, car, cdr=None):
self.car = car
self.cdr = cdr
def __repr__(self):
return "({car}, {cdr})".format(car=self.car, cdr=self.cdr)
@Sourceless
Sourceless / gist:4588242
Last active December 11, 2015 10:38
Get frequencies of words from the comments of n subreddit pages. Most of the variables you may want to change are in main(). It produces a reddit markdown table to console of the 200 most common words, and outputs a raw dump of all words. Rate limited to under 30 requests/second. If anyone wants to play with this, or take it on, it needs a user …
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Author: github.com/Sourceless
from urllib2 import urlopen, HTTPError, URLError
from socket import timeout
from time import sleep
from collections import Counter
import json