Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am aredondo on github.
  • I am unsleepable (https://keybase.io/unsleepable) on keybase.
  • I have a public key ASDv6SW_ILSlYdw-WaMeZrFtoKO4jUEFWJfgNPgTkGDDIwo

To claim this, I am signing this object:

@aredondo
aredondo / gist:ac410cdf1e86b078269b
Created December 31, 2015 11:42
Creating a git branch without ancestry
# http://madduck.net/blog/2007.07.11:creating-a-git-branch-without-ancestry/
$ git symbolic-ref HEAD refs/heads/newbranch
@aredondo
aredondo / gist:4c9dec6a7964a3a4d83d
Created December 19, 2015 13:42
Convert pdf to black and white bitmap
gs -sDEVICE=bmpgray -dNOPAUSE -dBATCH -r300x300 \
-sOutputFile=./pdf_image.bmp ./input.pdf
convert ./pdf_image.bmp -threshold 40% -compress zip ./bw_out.pdf
@aredondo
aredondo / abstract_mysql_adapter_patch.rb
Created September 8, 2013 16:00
Patch ActiveRecord::ConnectionAdapters::AbstractAdapter to use a different MySQL engine
module ActiveRecord
module ConnectionAdapters
class AbstractAdapter
def self.inherited(subclass)
if subclass.name =~ /AbstractMysqlAdapter$/
subclass.singleton_class.send :define_method, :method_added, lambda { |method_name|
if method_name == :create_table and not subclass.method_defined?(:prev_create_table)
subclass.send :alias_method, :prev_create_table, :create_table
subclass.class_eval do
def create_table(table_name, options = {})
@aredondo
aredondo / uninstall-audio-essentials.sh
Last active December 22, 2015 01:49
Uninstall SRS Audio Essentials
# Works with version 1.0.5
sudo rm -vfr /Applications/Audio\ Essentials.app
launchctl -v unload /Library/LaunchAgents/com.srs.EssentialsAgent.plist
launchctl -v remove com.srs.EssentialsAgent
sudo rm -v /Library/LaunchAgents/com.srs.EssentialsAgent.plist
sudo rm -vfr /Library/PrivilegedHelperTools/EssentialsAgent.app
@aredondo
aredondo / gist:6354696
Created August 27, 2013 14:59
Enable NAT from the CLI in OS X
sudo -s
ifconfig en1 x.x.x.1/24 alias
sysctl -w net.inet.ip.forwarding=1
natd -interface en1
ipfw -f flush
ipfw add divert natd all from any to any via en1
ipfw add pass all from any to any