Skip to content

Instantly share code, notes, and snippets.

View Roasbeef's full-sized avatar
🏂
squad up 🏂

Olaoluwa Osuntokun Roasbeef

🏂
squad up 🏂
View GitHub Profile
@Roasbeef
Roasbeef / Pe_16_solution.py
Created March 28, 2012 17:49
Project Euler Problem #16 Solution
#Sum of digits of 2^1000
from functools import reduce
#Solution Number:1
reduce(lambda a,b: a+b, [int(x) for x in str(2**1000)])
#Solution Number:2
sum([int(x) for x in str(2**1000)])
@Roasbeef
Roasbeef / gist:2946464
Created June 18, 2012 02:23
List-comp Quicksort
def quicksort(lst):
if len(lst) == 0:
return []
else:
return quicksort([x for x in list[1:] if x < lst[0]]) + [list[0] + \
quicksort([x for x in list[1:] if x >= lst[0]])
@Roasbeef
Roasbeef / weather_bot.py
Created June 27, 2012 21:34
Weather Bot
import tweepy
import time
def get_weather(city):
'''
returns a dictionary of the forecast for a specified city
'''
import requests
from xml.dom import minidom
@Roasbeef
Roasbeef / gist:3084985
Created July 10, 2012 17:40
Start of URL Shortener
import os
import requests
'''
url = self.request.get('url')
try:
l = Link()
l.seed(url)
except ValueError:
self.render('index.html', error='Invalid Url')
'''
@Roasbeef
Roasbeef / pizza.py
Created October 18, 2012 19:11 — forked from nelsonjchen/pizza.rb
ACM Micro-Challenge 1
from math import ceil
# Write a function called numPizzas, that takes the number of people present,
# the number of slices in a pizza, and the time of day, and returns the
# number of pizzas to buy (as a whole integer).
#
# Spec:
# Signature: int numPizzas(int numPeople, int slicesPerPizza, int time)
# Time is an int on 24-hour clock (0-23), e.g. 8 = 8am, 14 = 2pm
# 11 = 11am 11pm = 23
@Roasbeef
Roasbeef / challenge.py
Created December 9, 2012 04:12
Christmas Reddit Challenge
from collections import Counter
import requests
r = requests.get("http://www.reddit.com/r/christmas/new.json?sort=new&limit=100")
data = json.loads(r.content)
titles = ''.join(submission['data']['title'] for submission in data['data']['children'])
title_words = [word for word in titles.split() if len(title) > 4 and title.isalpha()]
top_count = Counter(title_words).most_common(5) #[(u'Christmas', 52), (u'Santa', 6), (u'about', 4), (u'first', 4), (u'Holiday', 4)]
@Roasbeef
Roasbeef / keybase.md
Created June 12, 2014 21:50
keybase.md

Keybase proof

I hereby claim:

  • I am roasbeef on github.
  • I am roasbeef (https://keybase.io/roasbeef) on keybase.
  • I have a public key whose fingerprint is 22A7 C9B3 4B87 24FF EAD5 9B0A ABA2 7102 5DF9 FA50

To claim this, I am signing this object:

Verifying that +roasbeef is my openname (Bitcoin username). https://onename.io/roasbeef
@Roasbeef
Roasbeef / publickey.gpg
Created September 19, 2015 18:24
pubkey
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2.0.22 (GNU/Linux)
mQINBFXx788BEACuas8986iaZS6n3nkRrFSd+I4AWyb7TbOsmLGrMKmbKbZKSWpI
0cKWX88m1I8VZr1ELgkneHsRGgHxonY+FGsiA1JaYbvN3qT7hXrWggVsfhqr6vg/
8RVdSHolatX4hdWl0zZQ6gT6yTk8wzrxCTJD4AUiRec1Tff4gHJDZLn5cvYPMAgI
ex4EqfDeAxSkyjMyMZ+W3uBGAyk5oihUnkaj4FsQH8nhhAr0fLUnBV2gmPPWm7d0
IHpX9KiXorDGdEWhVSIEExBMDXHG4C/nwJiFYRTqkbrVVXo9xdhWJ6V5ewDUUegX
cuEiSLMj1cj0ORvRiZHaa213GgfEVg95nFnLorg7LEzBo3V7IrjKMdwG17Z/Wgsh
UNvJEXaHn1+LoZWVVijtS79f08AKRyI0axaxRikjP5FgUDnSExhVu1IZLb2WS+l7
@Roasbeef
Roasbeef / rpc.cert
Last active January 31, 2017 21:53
kek the rpc cert
https://drive.google.com/file/d/0Bw2QYpaOa7bTVGZFVHVlXzd1RGc/view?usp=sharing