Skip to content

Instantly share code, notes, and snippets.

View tristanwietsma's full-sized avatar

Tristan Wietsma tristanwietsma

  • Chicago, Illinois
View GitHub Profile
@tristanwietsma
tristanwietsma / .block
Created October 6, 2017 16:38 — forked from mbostock/.block
Brush & Zoom
license: gpl-3.0
quant=> \d+ regsho
Table "public.regsho"
Column | Type | Modifiers | Storage | Stats target | Description
-------------+--------+-----------+----------+--------------+-------------
Symbol | text | | extended | |
Date | text | | extended | |
ShortVolume | bigint | | plain | |
TotalVolume | bigint | | plain | |
Indexes:
"ix_regsho_Date" btree ("Date")
@tristanwietsma
tristanwietsma / ch1.md
Last active May 17, 2019 03:01
Scala for the Impatient

Exercise 1

scala> 3.
%   +   >    >>>            isInstanceOf   toDouble   toLong     unary_+   |
&   -   >=   ^              toByte         toFloat    toShort    unary_-
*   /   >>   asInstanceOf   toChar         toInt      toString   unary_~

Exercise 2

@tristanwietsma
tristanwietsma / README
Last active August 29, 2015 14:20
Jest Example
# Jest Example
This is directly from the jest website.
## Requirements
- node
- npm
## Install
@tristanwietsma
tristanwietsma / hist.go
Created October 1, 2014 03:58
Golang image histogram (taken from Go site)
package main
import (
"flag"
"fmt"
"image"
_ "image/gif"
_ "image/jpeg"
_ "image/png"
"log"
@tristanwietsma
tristanwietsma / term2gif.sh
Created August 27, 2014 14:53
Record terminal session to GIF
#!/bin/bash
TIMING=$1
SCRIPT=$2
W=$WINDOWID
rm -rf /tmp/script-replay-gifs/
mkdir /tmp/script-replay-gifs/
t=$(mktemp)
/*
** Client side - /public/src/app.js
*/
var myApp = {
// Collections
Collections: {
list: Backbone.Collection.extend()
},
// Views
class LazyCollection extends Backbone.Collection
indexQuerystring: 'index'
index: 1
lastLength: 0
fetch: (options) ->
options or= {}
if options.reset
@index = 1
@lastLength = 0
else
require 'pp'
require 'socket'
module BluetoothPolarHrm
AF_BLUETOOTH=31 # these are correct for the Linux Bluez stack
BTPROTO_RFCOMM=3
class << self
def connect_bt address_str,channel=1
bytes=address_str.split(/:/).map {|x| x.to_i(16) }
s=Socket.new(AF_BLUETOOTH, :STREAM, BTPROTO_RFCOMM)
@tristanwietsma
tristanwietsma / mockery.py
Created July 8, 2014 02:52
Mocking Boto with Moto
import boto
from moto import mock_s3
from model import MyModel
@mock_s3
def test_save_study():
conn = boto.connect_s3()
conn.create_bucket('mybucket')