Skip to content

Instantly share code, notes, and snippets.

@eegrok
eegrok / toggle-mic-mute.applescript
Last active December 13, 2015 21:49
applescript to toggle mute / notify via growl
tell application "System Events"
set isRunning to (count of (every process whose bundle identifier is "com.Growl.GrowlHelperApp")) > 0
end tell
if isRunning then
tell application id "com.Growl.GrowlHelperApp"
-- Make a list of all the notification types
-- that this script will ever send:
set the allNotificationsList to ¬
{"Microphone Muted", "Mic Live"}
@eegrok
eegrok / README.md
Created September 13, 2012 09:30
CC Validation

Example Usage -- use ruby 1.9.3

git clone git@gist.github.com:3713188.git ccvalidator

cd ccvalidator

cat input1.dat | ./validate_cards.rb

ruby test/credit_card_validator_spec.rb

@eegrok
eegrok / awk-row-column.txt
Created August 21, 2012 22:22
awk retrieve specific row / column
2nd row 4th column
cat blah | awk 'NR==2 {printf "%s", $4}'
NR -- ordinal number of the current record
NF -- number of fields in the current record
(see man for awk for other stuff)
@eegrok
eegrok / locate.updatedb.update
Created June 28, 2012 23:09
osx locate.updatedb script -- edit to make all files visible to you findable via locate
from: http://recoveringphysicist.com/16/limitations-of-the-mac-osx-locate-utility
(normally files in directories that aren't readable by the nobody user / world readable are not locateable).
One can edit a copy of /usr/libexec/locate.updatedb and put the edited copy in place either by hand or via launchctl. I replaced three occurrences of “nobody” with my username in that script, reran it, and now locate reports on all files under ~/Library — indeed on all files readable by my user.
@eegrok
eegrok / change-win-pass.txt
Created April 4, 2012 17:59
change / reset windows stored passwords on windows xp
rundll32.exe keymgr.dll, KRShowKeyMgr
@eegrok
eegrok / Gemfile
Created March 29, 2012 00:31 — forked from vangberg/README
Deploying a Sinatra app with database to Heroku
source 'http://rubygems.org'
gem 'rack'
gem 'sinatra'
gem 'dm-core'
gem 'haml'
gem 'dm-postgres-adapter'
gem 'dm-migrations'
gem 'pg'
@eegrok
eegrok / remote-desktop-login-too-many.txt
Created March 5, 2012 19:56
How to login with RDP if you have too many connections to the server -- remote desktop
#execute the following from the command prompt
mstsc /v:<ip-address> /admin
you can kick other people off by running (on the remote box)
query session
then
logoff <sessionid> /server /v
@eegrok
eegrok / install-rvm-lucid.sh
Created March 1, 2012 21:54
install rvm on new 10.04 install
sudo apt-get install ruby
sudo apt-get install curl git-core bison build-essential zlib1g-dev libssl-dev libreadline6-dev libxml2-dev autoconf libxslt1-dev libpq-dev postgresql --fix-missing
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
#fix your bashrc
# put the following line at the end of your .bashrc
[[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm
@eegrok
eegrok / build-deploy-gem.md
Created January 27, 2012 01:57
build / deploy gem
@eegrok
eegrok / test_errors.rb
Created January 16, 2012 23:11
interesting error catching method / singleton_class (class << self) stuff
def errors_with_message(pattern)
# Generate an anonymous "matcher module" with a custom threequals m = Module.new
m = Module.new
# next 3 lines are equivalent
# (m.singleton_class.class_eval { self }).instance_eval do
m.singleton_class.instance_eval do
# (class << m; self; end).instance_eval do
define_method(:===) do |e|
pattern === e.message
end