Skip to content

Instantly share code, notes, and snippets.

View onewland's full-sized avatar

Oliver Newland onewland

  • San Francisco, CA
View GitHub Profile
7b701b64404c :) create table test_null_storage (pkey Int64, key Int64, floatColumn Float64, floatColumnNull Nullable(Float64), arrayColumn Array(Int64)) ENGINE = MergeTree() ORDER BY key PARTITION BY pkey;
CREATE TABLE test_null_storage
(
`pkey` Int64,
`key` Int64,
`floatColumn` Float64,
`floatColumnNull` Nullable(Float64),
`arrayColumn` Array(Int64)
)
convert snapshot.jpg -colorspace gray -sigmoidal-contrast 10,40% snapshot-gray2.jpg
convert snapshot-gray2.jpg -crop 330x720+445+0 snapshot-crop.jpg
convert snapshot-crop.jpg -resize 480x1080\! snapshot-crop-resized.jpg
screen is 1920x1080
montage -geometry 480x1080 -tile 4x1 snapshot-crop-resized.jpg snapshot-crop-resized.jpg snapshot-crop-resized.jpg snapshot-crop-resized.jpg snapshot-montage.jpg
@onewland
onewland / eat_the_rich.py
Last active August 29, 2015 14:03
red screen, "eat the rich" on button press
import pygame
import RPi.GPIO as GPIO
import time
pygame.init()
channel = 18
red = pygame.Color(255,50,50)
white = pygame.Color(255,255,255)
black = pygame.Color(0,0,0)
@onewland
onewland / redis.go
Created July 29, 2012 20:31
redis.go with flag.Parse fix
// lines 529-on
// ----------------------------------------------------------------------------
// package initiatization and internal ops and flags
// ----------------------------------------------------------------------------
// ----------------
// flags
//
// go-redis will make use of command line flags where available. flag names
@onewland
onewland / gist:2926465
Created June 13, 2012 20:57
SFMTA snippet
When a driver pulls into the bus yard with a problem, she'll fill out a defect card and
hand it to a mechanic at a central point called "the tower." From there, the "tower man"
will manually enter the data from the defect card into Muni's computer system, noting,
say, a blown headlight. He'll then inform his immediate supervisor, who assigns a second
mechanic to deal with changing the bulb. That mechanic then ambles to the storeroom and
requests the part from the shopkeeper.
So, if you're looking to answer the question: "How many Muni employees does it take to
change a light bulb?" the answer is five. But the bulb hasn't been changed yet.
This file has been truncated, but you can view the full file.
infarction -> myocardial
myocardial -> infarction
infarction -> myocardial died
infarction myocardial -> died
infarction died -> myocardial
myocardial -> infarction died
myocardial died -> infarction
died -> infarction myocardial
infarction -> died
died -> infarction
$points = {}
def points(array, val)
array.each do |x|
$points[x] = val
end
end
points(%w{A E I L N O R S T U}, 1)
points(%w{D G}, 2)
diff --git a/app/models/user.rb b/app/models/user.rb
index db473e4..12179b9 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -454,7 +454,7 @@ class User < Principal
end
# Returns the anonymous user. If the anonymous user does not exist, it is created. There can be only
- # one anonymous user per database.
+ # one highlander.
@onewland
onewland / testq.rb
Created May 16, 2011 22:09
Last question
class Cylinder
def initialize(r,h)
@r = r
@h = h
end
def volume
pi * r * r * h
end
end
@onewland
onewland / strstr.rb
Created December 6, 2010 16:27 — forked from rachelmyers/strstr
def substring(haystack, needle)
0.upto(haystack.length) do |i|
return i if haystack[i,(needle.length)] == needle
end
return nil
end
puts substring("stupid", "smart")
puts substring("stupid", "stu")
puts substring("stupid", "pid")