Skip to content

Instantly share code, notes, and snippets.

View xavdid's full-sized avatar
🏠
Working from home

David Brownman xavdid

🏠
Working from home
View GitHub Profile
"""
get permutations of schedules and assign students to them
"""
import csv
from itertools import permutations
from random import choice
MAX_CLASS_SIZE = 27
@xavdid
xavdid / crash.txt
Created May 16, 2017 21:58
Chrome is crashing a lot today
May 16 14:49:47 TBP GoogleSoftwareUpdateAgent[71264]: 2017-05-16 14:49:47.684 GoogleSoftwareUpdateAgent[71264/0x7fffb06d03c0] [lvl=2] -[KSAgentApp setupLoggerOutput] Agent settings: <KSAgentSettings:0x100538a30 bundleID=com.google.Keystone.Agent lastCheck=2017-05-16 17:35:22 +0000 checkInterval=18000.000000 uiDisplayInterval=604800.000000 sleepInterval=1800.000000 jitterInterval=900 maxRunInterval=0.000000 isConsoleUser=1 ticketStorePath=/Users/david/Library/Google/GoogleSoftwareUpdate/TicketStore/Keystone.ticketstore runMode=3 daemonUpdateEngineBrokerServiceName=com.google.Keystone.Daemon.UpdateEngine daemonAdministrationServiceName=com.google.Keystone.Daemon.Administration logEverything=0 logBufferSize=2048 alwaysPromptForUpdates=0 productIDToUpdate=(null) lastUIDisplayed=(null) alwaysShowStatusItem=0 updateCheckTag=(null) printResults=NO userInitiated=NO>
May 16 14:49:48 TBP ksadmin[71268]: Using ticket store: <KSPersistentTicketStore:0x10070e8e0 store=<KSKeyedPersistentStore:0x10070f120
path="/Library/G
@xavdid
xavdid / demo.ts
Created March 3, 2017 16:42
Typescript Demo
import * as _ from 'lodash'; // or import _ = require('lodash')
interface HTTPRequest{
code: 200|400;
message: string;
}
class Employee {
name: string;
age: number;

Keybase proof

I hereby claim:

  • I am xavdid on github.
  • I am xavdid (https://keybase.io/xavdid) on keybase.
  • I have a public key whose fingerprint is 0FF0 25F2 9820 1D4F 3E9D FBBE C291 498D 768E 39EE

To claim this, I am signing this object:

@xavdid
xavdid / example.js
Created April 10, 2016 23:55
Fat arrow scope conundrum
'use-strict';
// using node v5.7.1
var funcs = {
speak: function(){
console.log(this.name + ' says hi');
},
name: 'david'
};
@xavdid
xavdid / basic_server.rb
Created April 5, 2016 23:29
Dirt simple sinatra server
require 'sinatra'
require 'json'
get '/' do
'Hello, World!'
end
get '/data' do
{name: 'Sean', age: 24}.to_json
end
@xavdid
xavdid / converter.rb
Last active March 10, 2016 21:02
Convert Salesforce 15 digit id to 18
class InvalidIdError < RuntimeError
end
def convert_to_18(id)
if id.nil?
return nil
elsif id.size != 15
puts "INVALID ID: #{id}"
raise InvalidIdError
end
@xavdid
xavdid / bad.rb
Last active August 29, 2015 14:27
Proof of concept for ruby refinements
class Fixnum
def dance
puts "I'M THE BEST DANCER"
end
end
@xavdid
xavdid / get_price_drop.py
Last active August 29, 2015 14:11
Grabs an appshopper feed url and returns the most recent discount
# Given an appshopper url, find the most recent price drop
# author: David Brownman
# www: davidbrownman.com
# NOTE: the clipboard module is unique to pythonista.
import clipboard
import feedparser
import re
import webbrowser
@xavdid
xavdid / mwrc_rosters.rb
Created November 5, 2014 02:53
Make a roster from info pulled from quidditch-reference.com
require 'open-uri'
require 'nokogiri'
require 'pp'
require 'json'
# currently hardcoded for the MWRC event
def pull_players(team_code)
doc = Nokogiri::HTML(open("http://www.quidditch-reference.com/tournament/160/#{team_code}"))
rows = doc.xpath("//table//tr[position() > 1]")
team_name = doc.css("h2")[0].children[3].to_s