Skip to content

Instantly share code, notes, and snippets.

View l3x's full-sized avatar

Lex Sheehan l3x

  • Atlanta, GA
View GitHub Profile
# What I want is a Rails or Merb plugin that:
#
# * Prints "START" at the start and "END" at the end of each method.
# * That only requires me to enter acts_as_traceable in the class that I want to trace
#
# Output should look something like this:
#
# *** START myclass.mymethod ***
# processing...
# *** myclass.mymethod ***
# filename: install-nvm-npm-node
# author: Lex Sheehan
# purpose: To cleanly install NVM, NODE and NPM
# dependencies: brew
# references: http://lexsheehan.blogspot.com/2015/04/cleanly-install-nvm-node-and-npm.html
NOW=$(date +%x\ %H:%M:%S)
CR=$'\n'
REV=$(tput rev)
OFF=$(tput sgr0)
@l3x
l3x / gist:c9c8d935fdefca481c92
Created July 8, 2015 19:35
Cleanly Install NVM, NODE and NPM on OSX
# filename: install-nvm-npm-node
# author: Lex Sheehan
# purpose: To cleanly install NVM, NODE and NPM
# dependencies: brew
# see: http://lexsheehan.blogspot.com/2015/04/cleanly-install-nvm-node-and-npm.html
NOW=$(date +%x\ %H:%M:%S)
CR=$'\n'
REV=$(tput rev)
@l3x
l3x / keybase.md
Created December 17, 2017 21:22
Keybase Proof Gist

Keybase proof

I hereby claim:

  • I am l3x on github.
  • I am l3x (https://keybase.io/l3x) on keybase.
  • I have a public key ASBtYxVg2aS3mySdG3uJvcAtB4bUMuKnacLI6LGMmF3j7go

To claim this, I am signing this object:

@l3x
l3x / gist:dfcc043bdc617bb0dd3fdce6146205ae
Last active June 20, 2018 16:34
GetIPv4Address - A Go function to get your host's IPv4 address
// GetIPv4Address returns this node's IPv4 IP Address
// If more than one IP address found, call GetPreferredOutboundIP
// 127.0.0.1 will be returned if no other IPv4 addresses are found;
// otherwise, the non 127.0.0.1 address will be returned
// Assumes node has at least one interface (and the 127.0.0.1 address)
// If any errors occur, 127.0.0.1 will be returned
func getIPv4Address() (net.IP, error) {
ifaces, err := net.Interfaces()
if err != nil {
return nil, err
@l3x
l3x / docker_examples.md
Last active June 9, 2020 15:00
Docker Examples

Data Containers

Backup a data container to a .tar file in current, local, working directory.

docker run \
	--volumes-from dbdata \
	-v $(pwd):/backup \
	ubuntu \
	tar cvf /backup/backup.tar /dbdata