Skip to content

Instantly share code, notes, and snippets.

View jboynyc's full-sized avatar
🍜

John Boy jboynyc

🍜
View GitHub Profile
@jboynyc
jboynyc / topsy-scraper.py
Last active February 16, 2016 13:33
This is a short Python script to scrape data from Topsy through their API and store it in MongoDB. (Now they require an API key, so some changes are necessary to get it to work.)
#!/usr/bin/env python
from urllib2 import urlopen, urlencode
from pymongo import connection
import json
from optparse import OptionParser
from time import sleep
verbose = 1
parser = OptionParser()
@jboynyc
jboynyc / demo.css
Last active December 14, 2015 14:29
/* if you want images to drop a shadow */
img {
box-shadow: 10px 10px 5px #888;
}
/* if you want "fleurons" instead of bullets in unordered lists */
ul {
padding-left:1em;
list-style:none;
margin-left:0;
@jboynyc
jboynyc / LIESMICH.md
Last active December 16, 2015 18:39
Project Euler solutions

I moved my solutions to a full-fledged repo, so that's where you should go looking for my latest kludges.

@jboynyc
jboynyc / nth-prime.scm
Last active December 21, 2015 02:08
Chicken Scheme program to compute the *n*th prime number (where *n* can be passed as an argument from the command line). Should be compiled using `csc` for optimal performance. Written to brute force the result of a Project Euler problem.
#!/usr/bin/env csi -ss
(use srfi-42)
(define (range from upto)
(list-ec (:range n from upto) n))
(define (zero-length? l)
(= (length l) 0))
@jboynyc
jboynyc / sum-of-primes.scm
Last active December 21, 2015 04:09
Chicken Scheme program to compute the sum of all primes below the number passed via the command line. Used to brute force a Project Euler problem. Compile using `csc` for better performance.
(use srfi-42)
(define (range from upto)
(list-ec (:range n from upto) n))
(define (zero-length? l)
(= (length l) 0))
(define (no-remainder? n d)
(= (remainder n d) 0))
(define (rounded-sqrt n)
(inexact->exact (round (sqrt n))))
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
Bundestagswahl 2005
Endgültig
Nr;Gebiet;gehört;Wahlberechtigte;;;;Wähler;;;;Ungültige;;;;Gültige;;;;SPD;;;;CDU;;;;CSU;;;;GRÜNE;;;;FDP;;;;Die Linke.;;;;Offensive D;;;;REP;;;;NPD;;;;Die Tierschutzpartei;;;;GRAUE;;;;PBC;;;;DIE FRAUEN;;;;FAMILIE;;;;BüSo;;;;BP;;;;ZENTRUM;;;;Deutschland;;;;AGFG;;;;APPD;;;;50Plus;;;;MLPD;;;;Die PARTEI;;;;PSG;;;;Pro DM;;;;CM;;;;DSU;;;;HP;;;;HUMANWIRTSCHAFTS- PARTEI;;;;STATT Partei;;;;UNABHÄNGIGE;;;;Übrige;;;;
;;zu;Erststimmen;;Zweitstimmen;;Erststimmen;;Zweitstimmen;;Erststimmen;;Zweitstimmen;;Erststimmen;;Zweitstimmen;;Erststimmen;;Zweitstimmen;;Erststimmen;;Zweitstimmen;;Erststimmen;;Zweitstimmen;;Erststimmen;;Zweitstimmen;;Erststimmen;;Zweitstimmen;;Erststimmen;;Zweitstimmen;;Erststimmen;;Zweitstimmen;;Erststimmen;;Zweitstimmen;;Erststimmen;;Zweitstimmen;;Erststimmen;;Zweitstimmen;;Erststimmen;;Zweitstimmen;;Erststimmen;;Zweitstimmen;;Erststimmen;;Zweitstimmen;;Erststimmen;;Zweitstimmen;;Erststimmen;;Zweitstimmen;;Erststimmen;;Zweitstimmen;;Erststimmen;;Zweitstimmen;;Erststimmen;;
@jboynyc
jboynyc / eportfolio-media-xmlrpc.py
Created October 24, 2013 19:24
Get a list of all images attached to posts within a category. Uses WordPress' XML-RPC API, enabled by default in 3.5. Documentation for python-wordpress-xmlrpc: http://python-wordpress-xmlrpc.readthedocs.org/en/latest/index.html
config = {
'site' : 'doe13',
'user' : 'notarealname',
'password' : 'notarealpassword'
}
from wordpress_xmlrpc import Client
from wordpress_xmlrpc.methods import posts, media
def flatten(l):
@jboynyc
jboynyc / kv_store.py
Created June 18, 2014 17:16
simple persistent key-value store backed by... shelve
import shelve
from contextlib import closing
class Store:
'''Simple persistent key-value store.'''
def __init__(self, shelf='data.shelf'):
self.shelf = shelf
def store(self, key, value):
with closing(shelve.open(self.shelf)) as db:
db[key] = value

Keybase proof

I hereby claim:

  • I am jboynyc on github.
  • I am jboy (https://keybase.io/jboy) on keybase.
  • I have a public key whose fingerprint is C481 C66B 553D 9DC4 3A38 0164 74A7 A4B3 3DE1 D395

To claim this, I am signing this object:

@jboynyc
jboynyc / gradcenter_email_transition.md
Last active August 29, 2015 14:10
What I found out about the Graduate Center email transition

What I found out about the Graduate Center email transition

Following the announcement about the migration of Graduate Center email to the hosted Microsoft Office365 service (and thus the gradcenter.cuny.edu domain), I inquired with GC IT about when our old gc.cuny.edu addresses will expire, since the announcement sent out by IT was unclear on this point.

According to the help desk, our old addresses will not be phased out so much as killed:

Once June 1st comes around, the @gc.cuny.edu accounts will be removed from our