Skip to content

Instantly share code, notes, and snippets.

View michaelminter's full-sized avatar

Michael Minter michaelminter

View GitHub Profile
@michaelminter
michaelminter / dirtar.sh
Last active December 27, 2015 19:29
tar a directory # gzip, gunzip, linux, command line, mac
# -z: Compress archive using gzip program
# -c: Create archive
# -v: Verbose i.e display progress while creating archive
# -f: Archive File nam
tar -zcvf prog-1-jan-2005.tar.gz /home/jerry/prog
@michaelminter
michaelminter / listallcommands.md
Last active December 27, 2015 18:59
List all commands on the command line linux, mac, bash, shell

Add to .bashrc

function ListAllCommands
{
    echo -n $PATH | xargs -d : -I {} find {} -maxdepth 1 \
        -executable -type f -printf '%P\n' | sort -u
}

If you also want aliases, then:

@michaelminter
michaelminter / time.sh
Created November 1, 2013 23:30
Measure the amount of time it takes to run a terminal application
time bundle exec rake import:squat &
@michaelminter
michaelminter / config
Created November 1, 2013 16:45
~/.ssh/config Set hostname alias
Host staging
Hostname 1.1.1.1
Host production
Hostname 1.1.1.2
@michaelminter
michaelminter / os.sh
Created October 31, 2013 16:39
Determine OS information from command line
cat /proc/version #=>
Linux version 2.6.32.12-rscloud ([email protected]) (gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5) ) #26 SMP Mon May 17 12:35:34 UTC 2010
uname -a #=>
Linux staging 2.6.32.12-rscloud #26 SMP Mon May 17 12:35:34 UTC 2010 x86_64 GNU/Linux
cat /etc/*version #=>
squeeze/sid
cat /etc/*release #=>
#!/bin/bash
WGET='/usr/bin/wget'
# input validation
if [ ! -n "$1" ]
then
echo "You must enter a url as the first parameter"
echo "Usage: $0 <url>"
exit
fi
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Have no idea which one is the right one
##
# Your previous /Users/michaelminter/.bash_profile file was backed up as /Users/michaelminter/.bash_profile.macports-saved_2011-12-30_at_11:11:57
##
# MacPorts Installer addition on 2011-12-30_at_11:11:57: adding an appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
@michaelminter
michaelminter / irb.bash
Last active December 24, 2015 00:49 — forked from codeprimate/gist:6719279
Call irb with gem option
irb -Ilib -rGEMNAME
@michaelminter
michaelminter / menu.html
Created September 25, 2013 13:19
Menu unicode character
&#9776; Menu
@michaelminter
michaelminter / multiple_groups.sql
Last active December 22, 2015 18:19
Select n most recent of each category
CREATE TABLE genus (
id int auto_increment primary key,
name varchar(20)
);
INSERT INTO genus (name) VALUES
('Brachypelma'),
('Avicularia'),
('Nhandu'),
('Euathlus'),