Skip to content

Instantly share code, notes, and snippets.

View hh's full-sized avatar

Hippie Hacker hh

View GitHub Profile
@hh
hh / my-graphviz-mode-hook.el
Created February 22, 2011 08:27
call graphviz compile on a file, and display the image when the compile is complete
;(load-file "~/.elisp/graphviz-dot-mode.el")
; http://users.skynet.be/ppareit/projects/graphviz-dot-mode/graphviz-dot-mode.html
; graphviz-dot-mode.el
;;;;
;;;; dot-compile in background
;;;;
@hh
hh / usb_gprs_signal_strength.rb
Created March 5, 2011 05:38
This snippit allows me to look at the signal strength of the cell towers used by my ZTE usb modem.
# quick hack to monitor signal strength
# based on info from: http://www.pcurtis.com/ubuntu-mobile.htm#signal_strength
require 'rubygems'
require 'serialport'
require 'time'
class GSM
def initialize(options = {})
% rvm use 1.9.2@fog --create
Using /Users/codecafe/.rvm/gems/ruby-1.9.2-p180 with gemset fog
% gem install fog
% gem list
*** LOCAL GEMS ***
builder (3.0.0)
excon (0.6.0)
fog (0.7.1)
@hh
hh / integrity seems broken
Created April 4, 2011 03:13
I tried to follow the instructions at integrityapp.com...
$ git remote -v
origin git://github.com/integrity/integrity (fetch)
origin git://github.com/integrity/integrity (push)
$ git pull
Already up-to-date.
$ ruby -v
ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-darwin10.6.0], MBARI 0x6770, Ruby Enterprise Edition 2011.03
$ gem -v.
1.6.2
$ gem list
@hh
hh / active_record + sqlite bug
Created April 4, 2011 10:13
Pass in what should be a string as a symbol
$ rvm use 1.9.2@arfail
Using /Users/codecafe/.rvm/gems/ruby-1.9.2-p180 with gemset arfail
$ gem install sqlite3 activerecord
Fetching: sqlite3-1.3.3.gem (100%)
Building native extensions. This could take a while...
Successfully installed sqlite3-1.3.3
Fetching: activesupport-3.0.5.gem (100%)
Fetching: builder-2.1.2.gem (100%)
Fetching: i18n-0.5.0.gem (100%)
Fetching: activemodel-3.0.5.gem (100%)
z = 3 * 0x41662d2d * 123750872726249
o = []
puts z.to_s(16)
while z != 0
# let's eat through z one byte at a time
l = z >>4 &0xf #shift right then AND with 16 to get the character
r = z &0xf #just AND with 16 to get the XORed with l position in the array
o[r^l]=(l + 97).chr #put the character in the correct spot in the array
@hh
hh / gist:999754
Created May 31, 2011 02:00
Zentyal debian-installer seed file to allow an NZ biased 'No Questions Asked' install
We couldn’t find that file to show.
@hh
hh / chef-server:apache-proxy.sh
Created June 6, 2011 01:03
chef-server::apache-proxy failing out of bootstrap-latest.tar.gz
# this is run on a ubuntu 11.04 on ec2 via my user-data script
# https://github.com/hh/cookbooks/blob/master/chefserver-ec2-userdata.sh#L78
# but the meaty broken bits are here:
gem install chef
cat <<SOLOCONFIG>/root/chef-solo.rb
file_cache_path "/tmp/chef-solo"
cookbook_path "/tmp/chef-solo/cookbooks"
SOLOCONFIG
@hh
hh / mydesktop-gconf.rb
Created June 9, 2011 02:10
My Desktop GConf settings
# "apt-get install libgconf2-ruby" on debian/ubuntu
require 'gconf2'
@gconf = GConf::Client.default
def ensure_plugin (my_plugin)
plugins = @gconf.get "/apps/compiz-1/general/screen0/options/active_plugins"
if not plugins.include? my_plugin
plugins << my_plugin
@gconf["/apps/compiz-1/general/screen0/options/active_plugins"]=plugins
end
@hh
hh / gnome-dvorak+us-keyboard-layout.rb
Created June 9, 2011 02:12
Gnome Dvorak and Us keyboard layout switcher
require 'gconf2'
@gconf = GConf::Client.default
#these settings drive me nuts, if you want to 'switch' between them using something like shift and capskey
@gconf["/desktop/gnome/peripherals/keyboard/kbd/options"]=["grp\tgrp:shift_caps_toggle",]
# using this next line in dvorak layout, control-e sends control-d
@gconf["/desktop/gnome/peripherals/keyboard/kbd/layouts"]=["us","us\tdvorak",]
# using this next line in us layout, control-d sends control-e
@gconf["/desktop/gnome/peripherals/keyboard/kbd/layouts"]=["us\tdvorak","us"]
# which basically means any composed keys you want to use while runing a secondary layout, use the primary layout
# I think this is to help memory keybindings stay the same for someone who types in mulitple languages