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 / 0_fix_icestudio.sh
Last active September 25, 2016 21:22
Fixing icestudio's binaries to upload to icestick
#!/bin/bash
# Downloaded FTDI Driver from here: http://www.libdivecomputer.org/drivers.html http://www.ftdichip.com/Drivers/VCP/MacOSX/FTDIUSBSerialDriver_v2_3.dmg and installed it first.
# Did forgotten things with the ~/.icestudio venv and reinstalled apio a couple times via the UI.
homebrew_lib=/opt/boxen/homebrew/lib/
for k in ~/.apio/packages/system/find_all ~/.apio/packages/toolchain-icestorm/bin/iceprog do
echo "libftdi1.2.dylib libftdi1.2.dylib
/Users/bqlabs/develop/tools-usb-ftdi/build_darwin/lib/libusb-1.0.0.dylib libusb-1.0.0.dylib
/usr/local/opt/libusb/lib/libusb-1.0.0.dylib libusb-1.0.0.dylib
@tsnow
tsnow / testlib.sh
Created December 20, 2015 21:10 — forked from rtomayko/testlib.sh
Simple shell command language test library.
#!/bin/sh
# Usage: . testlib.sh
# Simple shell command language test library.
#
# Tests must follow the basic form:
#
# begin_test "the thing"
# (
# set -e
# echo "hello"
@tsnow
tsnow / a_selection_of_tests.log
Last active August 29, 2015 14:22
Markov, you silly bitch.
bash-3.2$ ebooks gen model/anachronistic.model "George Clooney attacks NYT"
@cmd if George has no fighting skills and typically exposes his schedule is generally so packed that he needs a break.
bash-3.2$ ebooks gen model/anachronistic.model "George Clooney attacks New York"
@cmd when nature attacks me like that he needs a quick death.
bash-3.2$ ebooks gen model/anachronistic.model "George Clooney attacks New York"
@cmd George is uber lazy today; he's hidden away, asleep somewhere because his belly to facilitate a quick death.
bash-3.2$ ebooks gen model/anachronistic.model "George Clooney attacks New York"
@cmd George is uber lazy today; he's hidden away, asleep somewhere because his belly to wield it, we're all goners.
bash-3.2$ ebooks gen model/anachronistic.model "George Clooney attacks New York"
@cmd George is uber lazy today; he's hidden away, we're all goners.
- Information and the Nature of Reality, Davies and Gregersen
- Swarm Intelligence, Bonabeau, Dorigo, Theraulaz
- Chaos, ed. Arun V. Holden
- Linked, Baraboa
- The Origins of Order, Kauffman
- Investigations, Kauffman
- Emergence, Steven Johnson
- Elements of Information Theory, Cover, Thomas
- The End of Certainty, Prigogine
- Physical Fluid Dynamics, Tritton

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

func fetch(c *check) {
f := &fetcher{}
for {
f.once(c)
}
}
struct fetcher {
resp *http.Response
err error
}
@tsnow
tsnow / Minstack.rb
Created January 24, 2015 18:59
Min stack
#How does this look?
class Stack
  class Start; end
  class Empty < null; end
  def pop
    return Empty if empty?
    .. #implementation
  end
  def push(val)

FROM @anachronistic:

BTW, in case it's not obvious (because after some talking with people it's definitely not obvious, and it wasn't obvious to me in the Go code I wrote months back), embedded types are more or less extend in Go (that is to say, they are the way to composition).

ex. I have a BlogPost struct that records the number of views a particular post has received. I realize that my RecordView method is not threadsafe, so I decide I want to lock a mutex, then update, then unlock (yes, atomic update is faster, but I'm really just proving a structural point here).

type BlogPost struct {
    ID            int
@tsnow
tsnow / ruby_keywords.md
Last active August 29, 2015 14:05
"Ruby keywords can have methods called on them?" No. But sometimes they return values.

Keyword list in Ruby: http://ruby-doc.org/docs/keywords/1.9/

% for i in BEGIN   END   __ENCODING__   __END__   __FILE__   __LINE__   
alias   and   begin   break   case   class   def   defined\?   do   else   elsif   end   ensure   false   for   
if   in   module   next   nil   not   or   redo   rescue   retry   return   self   super   then   true   undef   unless   
until   when   while   yield  ;

do 
echo $i; 
@tsnow
tsnow / inprogressbranches.md
Last active August 29, 2015 14:04
Tim Snowhite In Progress Branches
~/src$ find . -type d -depth 1 | while read i; do cd $i; git branch -r | while read j; do git log -n 1 --pretty=format:"$i $j %an" $j  | grep -i snowhite; done; cd ~/src; done 2>/dev/null | sed -e 's/Tim Snowhite//' -e 's,origin/,,' -e 's,^./,,' | grep -v 'deploy-'  | while read repo branch; do echo "https://github.com/ridecharge/$repo/compare/$branch"; done