Skip to content

Instantly share code, notes, and snippets.

export ORIG_GEM_PATH=${GEM_PATH:-}
export ORIG_GEM_HOME=${GEM_HOME:-}
export ORIG_PATH=${PATH}
omg() {
if [[ "$1" =~ "^h(elp)?\$" ]]; then
echo "Usage: omg [h|help|r|reset]"
elif [[ "$1" =~ "^r(eset)?\$" ]]; then
if [[ -z "$ORIG_GEM_HOME" ]]; then
unset GEM_HOME
@RobertAudi
RobertAudi / shot
Last active August 29, 2015 13:57
Take a screenshot and upload it to imgur.com, all from the command-line. OS X and ZSH. Inspired by https://github.com/JonApps/imgur-screenshot
#!/usr/bin/env zsh
#### CONFIG #######################################################################################
#### !!! REQUIRED !!! Put your imgur API key in the `IMGUR_KEY` environment variable.
#### Image format
# local image_format="jpg"
#### Show cursor (only in full screen screenshots)
@RobertAudi
RobertAudi / ts
Created March 6, 2014 13:40
ZSH wrapper around tarsnap
#!/usr/bin/env zsh
commandIsValid() {
cmds=( "h" "help" "l" "list" "z" "zip" "rm" "remove" )
local cmd="$1"
for e in $cmds[@]; do
if [[ "$e" == "$cmd" ]]; then
return 0
fi
#!/usr/local/bin/fish
set -l new_commit_message_file "/tmp/gishtank_temporary_commit_message"
echo " " | tr -d " " > $new_commit_message_file
if test (count (cat $argv[1] | tail -n +2 | /usr/bin/grep "^[^#]")) -le 21 -a (count (cat $argv[1])) -lt 51
if test (count (cat $argv[1] | tail -n +2 | /usr/bin/grep "^[^#]")) -gt 0
echo "#" >> $new_commit_message_file
echo "# Commit diff (Status at EOF)" >> $new_commit_message_file
echo "#" >> $new_commit_message_file
@RobertAudi
RobertAudi / chgems.fish
Last active December 30, 2015 12:59
Implementation of chgems for the Fish shell (chgems is like gemsets, but without RVM)
#!/usr/local/bin/fish
function chgems --description="Gemsets without RVM"
set -gx CHGEMS_VERSION "0.3.3"
switch "$argv[1]"
case "-V" "--version"
echo "chgems $CHGEMS_VERSION"
return
case "-h" "--help"
ack
aria2
autojump
cmake
ctags
dtrx
elinks
ghi
git
gti
#!/bin/sh
(ssh <user>@<ip> -o PermitLocalCommand=no \
": > .irssi/fnotify ; tail -f .irssi/fnotify " | \
while read heading message; do \
growlnotify -s -t "${heading}" -m "${message}"; \
done)&
# Touch n files with random names
randtouch() {
# A number of files to create must be specified
if [[ -n "$1" ]] && [[ "$1" = "${1%%[!0-9]*}" ]]; then
# Check if an extension was specified
if [[ -n "$2" ]]; then
# Extensions can only contain 2-10 letters
if [[ "$2" =~ ^\\.?[a-z]{2,10}$ ]]; then
@RobertAudi
RobertAudi / skype
Created October 10, 2013 18:08
`skype help`
#!/usr/local/bin/zsh
if [[ $1 = "auth" ]]; then
echo "Authorizing this script with Skype..."
osascript <<-APPLESCRIPT
tell application "Skype"
set onlineStatus to send command "GET USER " & "$contact" & " ONLINESTATUS" script name "getType"
end tell
set status to word 4 of onlineStatus
tell application "Skype" to activate
tell application "Skype"
delay 2
tell application "System Events" to keystroke return
end tell
tell application "Skype" to get URL "skype:<skype_handle>?call"