Skip to content

Instantly share code, notes, and snippets.

View jgyllen's full-sized avatar
👋

Jacob Gyllenstierna jgyllen

👋
View GitHub Profile
@jgyllen
jgyllen / gist:dc35f61a750f00aaaf64
Created February 13, 2015 06:36
Remove all Docker images and containers
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
@jgyllen
jgyllen / gist:a3b6c7af3508a0f61dd1
Created March 13, 2015 21:26
Convert Ruby 1.8 to 1.9 Hash Syntax
perl -pi -e 's/:([\w\d_]+)(\s*)=>/\1:/g' **/*.rb
@jgyllen
jgyllen / gist:9c5b0ed7d57b816af838
Created March 26, 2015 17:18
Disable Mac OS X bootup chime
sudo nvram SystemAudioVolume=%80

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:

# See http://geekystuff.net/2009/1/14/remove-all-ruby-gems
gem list | cut -d" " -f1 | xargs gem uninstall -aIx
@jgyllen
jgyllen / gist:839690
Created February 22, 2011 23:53
RabbitMQ+SSL with Ruby
# rabbitmq.config
[
{rabbit, [
{tcp_listeners,[{"127.0.0.1",5672}]},
{ssl_listeners, [{"127.0.0.1",5671}]},
{ssl_options, [{cacertfile,"/usr/local/etc/rabbitmq/ssl/testca/cacert.pem"},
{certfile,"/usr/local/etc/rabbitmq/ssl/server/cert.pem"},
{keyfile,"/usr/local/etc/rabbitmq/ssl/server/key.pem"},
{verify,verify_none},
{fail_if_no_peer_cert,false}]}
@jgyllen
jgyllen / gist:840163
Created February 23, 2011 08:15
Extracting information from an SSL certificate using OpenSSL
# Using the -text option will give you the full breadth of information.
openssl x509 -text -in cert.pem
# Other options will provide more targeted sets of data.
# who issued the cert?
openssl x509 -noout -in cert.pem -issuer
# to whom was it issued?
@jgyllen
jgyllen / gist:1238037
Created September 23, 2011 18:04
Showing hidden files in TextMate project drawer
Go to Preferences > Advanced > Folder Preferences and set File Pattern to:
!(/\.(?!.)[^/]*|\.(tmproj|o|pyc)|/Icon\r|/svn-commit(\.[2-9])?\.tmp)$
@jgyllen
jgyllen / gist:1353155
Created November 9, 2011 21:38
Equivalent of using MongoDB's $size operator for embedded collections
# All activities with one comment or more
Activity.collection.find('$where' => "function() { if (this['activity_comments'] && this['activity_comments'].length > 0) return true; }")
@jgyllen
jgyllen / gist:1386534
Created November 22, 2011 18:55
sed commands
# 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