View stm32_clocking.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'pp' | |
pp (2..15).map{|pllq| vco=pllq*48 ;{ {vco: vco,pllq: pllq} => [2,4,6,8].map{|pllp| { sysclk: vco/pllp,pllp: pllp }}}} |
View reload_test.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'sinatra' | |
require "sinatra/reloader" | |
get '/h' do | |
'Helllllo world!' | |
end | |
get '/t' do |
View index.haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#title Hello World! |
View abomination.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Abominate | |
def replace_object new_object | |
raise Exception.new( "Ia! Ia! Cthulhu Fhtagn!" ) unless instance_variable_defined? "@i_know_this_is_an_abomination" | |
context = class << self ; self ; end | |
new_object.instance_variables.each do |var| | |
instance_variable_set( var, new_object.instance_variable_get( var ) ) | |
end |
View get-docker-socket-from-remote
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# get-docker-socket-from-remote <name> <user>@<host> | |
# Create a unix socket at /tmp/<name>-docker.sock which, when | |
# used will ssh to <user>@<host> and connect to the docker | |
# socket at <host>:///var/run/docker.sock | |
# Note: | |
# 1. This forks a subjob that manages the local socket. | |
# Rmember to kill that when your finished |
View move_test.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void button2_Click(object sender, EventArgs e) | |
{ | |
int i = 0; | |
while (i < 10) | |
{ | |
rc.ManualDrive(1, 1); | |
i++; | |
} |
View time_formats.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ActiveSupport::TimeWithZone | |
alias_method :original_xmlschema , :xmlschema | |
def xmlschema(fraction_digits = 3) | |
original_xmlschema(fraction_digits) | |
end | |
end |
View unicorn.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Unicorn::HttpParser | |
alias old_read read | |
def read(socket) | |
env = old_read(socket) | |
DEFAULTS["rack.logger"].debug env["REQUEST_PATH"] | |
env | |
end | |
end |
View growl.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# ANDROID_NOTIFICATION is in the format DEVICE_ID/NOTIFICATION_ID/EVENT_TYPE/EVENT_CONTENTS | |
NOTIFICATION_TYPE="`echo $ANDROID_NOTIFICATION | sed 's/.*\/.*\/\(.*\)\/.*/\1/'`" | |
NOTIFICATION_DATA="`echo $ANDROID_NOTIFICATION | sed 's/.*\///'`" | |
if [ $NOTIFICATION_TYPE == "RING" ]; then | |
TEXT_TO_SAY="Call from" | |
elif [ $NOTIFICATION_TYPE == "SMS" ]; then |
View gist:2159621
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def base_url | |
@base_url ||= "#{request.env['rack.url_scheme']}://#{request.env['HTTP_HOST']}" | |
end |
OlderNewer