Skip to content

Instantly share code, notes, and snippets.

View kastner's full-sized avatar
🕳️
actively choosing...

Erik Kastner kastner

🕳️
actively choosing...
View GitHub Profile
@kastner
kastner / delta_calibration.g
Last active December 12, 2015 12:28
GCODE to ease delta tower home positioning; script for generating a homing script
; generated with
; curl -s https://gist.github.com/kastner/4772276/raw/e0f0fc66793eacc3f94fd8961e391b6499ad71b0/homward.rb | ruby -- - -77.94 -45 0 10
G28
G1 Z10 F80000
; center
G1 X0 Y0 F80000
G1 Z0 F1000
G4 S1
; visit all three towers and their oppisites
G1 Z10 F1000
require 'digest/md5'
key = YOUR_KEY
secret = YOUR_SECRET
params = {"from_date"=>"2013-01-01", "to_date"=>Time.now.strftime("%Y-%m-%d"), "api_key"=> key, "expire"=>Time.now.utc.to_i + 10000}
def pap(params, sep="&"); params.sort.map {|a| a.join("=")}.join(sep);end
url = "https://data.mixpanel.com/api/2.0/export?" + pap(params) + "&sig=#{Digest::MD5.hexdigest(pap(params, nil) + secret)}"
var textColor = function (bgColor) {
var output = runNetwork(bgColor);
if (output.black > .5) {
return 'black';
}
return 'white';
}
var runNetwork = function anonymous(inputs) {
var net = {"layers":[{"r":{},"g":{},"b":{}},{"0":{"bias":10.762609321045387,"weights":{"r":-1.6101593793420965,"g":-8.079421879958582,"b":-7.882746791637501}},"1":{"bias":7.175588252506214,"weights":{"r":-1.0511422879361831,"g":-5.602044992104212,"b":-6.278794890237195}},"2":{"bias":18.851966380700553,"weights":{"r":-7.484336046810216,"g":-15.237355119365034,"b":-3.489557046149576}}},{"black":{"bias":12.649899021596282,"weights":{"0":-10.474642369487578,"1":-7.487009391808981,"2":-19.021313930174223}}}]};
commit a73bcf381bf9e939383ee891ef6d41a1115ceb9f
Author: Erik Kastner <kastner@gmail.com>
Date: Sun Dec 9 00:34:57 2012 -0500
my configuration (pbj)
diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h
index 9db8dee..8cb3247 100644
--- a/Marlin/Configuration.h
+++ b/Marlin/Configuration.h
Active Profiles:
Battery Power -1
AC Power -1*
Currently in use:
standbydelay 4200
standby 1
womp 1
halfdim 1
hibernatefile /var/vm/sleepimage
darkwakes 1
/*
* Some game thing
*/
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "psmove.h"
@kastner
kastner / tire.diff
Created August 31, 2012 00:23
Tire patch to allow methods on the command line
--- tire/lib/tire/tasks.rb 2012-08-30 20:22:15.000000000 -0400
+++ tire-0.4.2/lib/tire/tasks.rb 2012-08-03 01:45:45.000000000 -0400
@@ -42,7 +42,7 @@
klass = eval(ENV['CLASS'].to_s)
params = eval(ENV['PARAMS'].to_s) || {}
- params.update :method => 'paginate'
+ params = {:method => 'paginate'}.update(params)
index = Tire::Index.new( ENV['INDEX'] || klass.tire.index.name )
hiveGetQuery <- function(query) {
tmpfn = tempfile("hive")
cmd = sprintf("ssh hadoop@HOST 'hive -e \"%s\" 2>/dev/null' 2>/dev/null > %s", query, tmpfn)
system(cmd, intern=TRUE)
df = read.table(tmpfn, sep='\t', header=FALSE, na.strings=c("null", "NaN"), fill=TRUE)
file.remove(tmpfn)
return(df[,1:ncol(df)-1]) #remove extra tab at end
}
#
# Ideas stolen from lograge and brought to Rails 2.3
# https://github.com/mattmatt/lograge/blob/master/lib/lograge/log_subscriber.rb
#
module ImprovedControllerLogging
def self.included(base)
base.alias_method_chain :log_processing, :fixup
base.inject_alias_method_chain :perform_action,
:perform_action_with_benchmark,
#!/usr/local/ruby-ent/bin/ruby
require 'rubygems'
require 'open-uri'
require 'json'
require 'cgi'
# the first part of a term must have no spaces
# the second part is the actual search on search.twitter.com you want counted
TERMS = {