Skip to content

Instantly share code, notes, and snippets.

View tsnow's full-sized avatar

Tim Snowhite tsnow

  • Palantir
  • Washington, DC
View GitHub Profile
@tsnow
tsnow / ride_diff.diff
Last active August 29, 2015 13:56
Driver info suggestions
- # if it's a Fleet provider but not virtual provider
- # refactor: have a flag on provider that indicates that there is additional info in Fleet database
- update_driver(params) if (provider.fleet_provider?(booking_channel.bit_mask) && driver && need_update_driver?(params))
-
- set_driver_tags(params)
-
+ info = RideDriverInfo.fetch(self,params)
+ params[:driver_phone_number] = info.driver_phone_number
+ params[:can_call_driver] = info.can_call_driver
+ params[:driver_photo_enabled] = info.driver_photo_enabled
rc> find . -type f -name 'ride.rb' -exec grep -o -e 'def [a-z_.]*' {} \; | awk '{print $2}' | sed 's/self.//' | while read i ; do ./count_methods_in_project.sh $i; done
@tsnow
tsnow / logd.go
Created February 16, 2014 21:17
Go Stdout logging daemon, listen to logs on telnet port 9900
package main
import (
"flag"
"io"
"log"
"os"
"os/exec"
"net"
"stressd/config"
@tsnow
tsnow / 0_README.md
Last active August 29, 2015 13:56
Helping Bryan

Instructions

Download bryan_tests.py and run it with python bryan_tests.py. Write functions in that file that implement the functionality described by the tests. When you're done, calling clean_file('C:\\whatever\\file\\path\\4_letter_words.txt') will give you the words you want.

From Bryan:

I was wondering if you've ever used Beautiful Soup to scrape words of a fixed length (4-letters) that don't repeat in order to create a dictionary - even better if none of the letters repeat? Though I'm looking through all manner of guides, I'm still not sure how to make that instruction.

@tsnow
tsnow / SalmonFTW.md
Created January 26, 2014 05:39
Salmon Recipe of Great justice

Here's my 'Very Good Easy Salmon' recipe, that I stole from Casey's exgirlfriend Adriana's Mom, and am now composing from memory. It's quite foolproof, which is to say, still somewhat tasty when screwed up, and easy to tweak. You shouldn't have difficulty improving it on your first try.

Very Good Easy Salmon

Makes: 1 hungry college student meal, and one delicious drunken midnight snack or 4 standard human equivalent portions. Time to completion: like maybe an hour, including shopping for ingredients.

  • Pacific Northwest Industry Standard Filet of Salmon (If bears and First Nations aren't it's main predators, you probably got the wrong kind.)
  • ~tsp juice of lemon
  • 1/2 cup soy sauce
@tsnow
tsnow / Gemfile
Last active January 4, 2016 08:09
Ruby script for Fourteen day count of gmail emails received
source 'https://rubygems.org'
gem 'ruby-gmail'
gem 'activesupport'
@tsnow
tsnow / rubocop_rc.sh
Created January 3, 2014 16:09
Rubocop
rc> gem install rubocop
rc> rubocop --format offences -R lib
3073 StringLiterals
1573 HashSyntax
1303 LineLength
1118 TrailingWhitespace
246 MethodLength
240 SpaceAfterComma
@tsnow
tsnow / HIPCHAT_USAGE.md
Last active January 2, 2016 02:49
Using Hipchat for business event notifications
$ API_KEY="alksdjflajledslajfdslkk" irb
1.9.3p448 :001 > require 'json'; require 'hipchat'
1.9.3p448 :002 > h=HipChat::Client.new(ENV['API_KEY'], :api_version => 'v2')
1.9.3p448 :011 > h['CodeClimate'].send('kitt', 'Booking & Payments: Tim Snowhite just paid for a ride: <a href="http://example.com/rides/1"> LA Yellow#300 Ride#1</a>', :format => 'html')
@tsnow
tsnow / live_vs_alive.rb
Created December 27, 2013 16:03
live vs alive
words = File.read('/usr/share/dict/words').lines.to_a.map(&:chomp);
a_words = words.select{|i| i =~ /^a.*/};
a_sub_words = words.select{|i| a_words.any?{|j| j[i]}};
a_sub_words.length
a_sub_words -= a_words
ad_words = a_sub_words.select{|i| a_words.include?("a#{i}")}; ad_words.length
@tsnow
tsnow / ex1.c
Created December 27, 2013 16:02
learn c the hard way
#include <stdio.h>
int main(int argc, char *argv[])
{
char *in;
in = gets(");
puts(in);
puts(argv[0]);
puts("Hello world.");
puts("Your face looks like a butt.");
puts("Rock me Amadeus.");