Skip to content

Instantly share code, notes, and snippets.

Avatar
👋

Jacob Gyllenstierna jgyllen

👋
View GitHub Profile
View gist:1e504a2757cee34f3db2
kill `ps aux | grep foo | grep -v grep | awk '{print $2}'`
View keybase.md

Keybase proof

I hereby claim:

  • I am jgyllen on github.
  • I am jgyllen (https://keybase.io/jgyllen) on keybase.
  • I have a public key whose fingerprint is 7F81 8107 D933 1BA2 5865 04E2 C48D 949A C251 EAAB

To claim this, I am signing this object:

@jgyllen
jgyllen / gist:9c5b0ed7d57b816af838
Created Mar 26, 2015
Disable Mac OS X bootup chime
View gist:9c5b0ed7d57b816af838
sudo nvram SystemAudioVolume=%80
@jgyllen
jgyllen / gist:a3b6c7af3508a0f61dd1
Created Mar 13, 2015
Convert Ruby 1.8 to 1.9 Hash Syntax
View gist:a3b6c7af3508a0f61dd1
perl -pi -e 's/:([\w\d_]+)(\s*)=>/\1:/g' **/*.rb
@jgyllen
jgyllen / gist:dc35f61a750f00aaaf64
Created Feb 13, 2015
Remove all Docker images and containers
View gist:dc35f61a750f00aaaf64
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
@jgyllen
jgyllen / config.ru
Created Oct 10, 2012
Sharing Rails cookie session with a Sinatra app
View config.ru
use Rack::Config do |env|
env[ActionDispatch::Cookies::TOKEN_KEY] = 'abc123' # Secret token from Rails config
end
use ActionDispatch::Session::CookieStore, key: '_myapp_session' # Session key from session store options in Rails config
run MyApp
@jgyllen
jgyllen / gist:2410991
Created Apr 18, 2012
Disabling the character picker in Mac OS X Lion
View gist:2410991
$ defaults write -g ApplePressAndHoldEnabled -bool false
@jgyllen
jgyllen / gist:2312464
Created Apr 5, 2012
Create a secure random string in Ruby 1.9
View gist:2312464
SecureRandom.base64(6).gsub(/[$=+\/]/,65.+(rand(25)).chr)
@jgyllen
jgyllen / gist:1995443
Created Mar 7, 2012
Print SSH key fingerprint
View gist:1995443
$ ssh-keygen -lf ~/.ssh/id_rsa.pub
View gist:1386534
# Find rows containing string 'foo' in file bar.txt
$ sed -n '/foo/p' < bar.txt
# Replace occurrences of 'foo' with 'bar' in baz.txt and backup original to baz.txt.bak
$ sed -i.bak -e 's%foo%bar%' baz.txt