Skip to content

Instantly share code, notes, and snippets.

View nerd190's full-sized avatar
🤓
coding to music 🎵

Scott nerd190

🤓
coding to music 🎵
  • London
View GitHub Profile
@jehiah
jehiah / simple_args_parsing.sh
Created March 4, 2011 16:56
a simple way to parse shell script arguments
#!/bin/sh
#
# a simple way to parse shell script arguments
#
# please edit and use to your hearts content
#
ENVIRONMENT="dev"
@technoweenie
technoweenie / gist:1072829
Created July 8, 2011 21:12
.netrc file so you can push/pull to https git repos without entering your creds all the time
machine github.com
login technoweenie
password SECRET
machine api.github.com
login technoweenie
password SECRET
@cdown
cdown / gist:1163649
Last active July 7, 2025 00:58
Bash urlencode and urldecode
urlencode() {
# urlencode <string>
old_lc_collate=$LC_COLLATE
LC_COLLATE=C
local length="${#1}"
for (( i = 0; i < length; i++ )); do
local c="${1:$i:1}"
case $c in
@spicycode
spicycode / tmux.conf
Created September 20, 2011 16:43
The best and greatest tmux.conf ever
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000
@iPenguin
iPenguin / bashrc
Last active September 29, 2022 00:39
git output in a bash prompt (PS1)
#The following lines should be added to your .bashrc file to use the git-output.awk file
SEP="║"
SEP2="•"
function parse_git_output {
path=$(pwd)
# Don't do git status over networked paths.
# It kills performance, and the prompt takes forever to return.
if [[ $path =~ "/net/" ]]; then
return
#compdef - my-zargs t
setopt localoptions extendedglob
() {
local -a tmp0 tmp1 tmp
# copied from _zargs
echo "\
-eof::=eof e::=eof \
-exit x \
@flixr
flixr / .zshrc
Created December 12, 2011 16:50
zsh config file
# .zshrc
# (copyleft) 2012 by Felix Ruess
#
# ---[ System settings ]------------------------------------------------
limit -s coredumpsize 0
umask 0027
@andrewrcollins
andrewrcollins / trim.awk
Created January 11, 2012 04:22
ltrim(), rtrim(), and trim() in awk
function ltrim(s) { sub(/^[ \t\r\n]+/, "", s); return s }
function rtrim(s) { sub(/[ \t\r\n]+$/, "", s); return s }
function trim(s) { return rtrim(ltrim(s)); }
BEGIN {
# whatever
}
{
# whatever
}
END {
anonymous
anonymous / minimal_todo.sh
Created January 14, 2012 13:21
Minimally Awesome Todos for Mac OS X
# Reference: http://blog.jerodsanto.net/2010/12/minimally-awesome-todos/
#
# Improvements:
#
# *) It now supports tracking multiple projects/todo files.
# *) Use 'cat -b' to get task order instead of hard-coding line number in files.
#
# 3 actions available:
# - Create a new task in project "prj": td prj task
# - Delete third task: tddone prj 3
@nivoc
nivoc / zshrc
Created April 23, 2012 23:39
my-zsh-config
# nivoc's zshrc file v0.1, based on:
# kcbanner's zshrc file v0.1 and
# jdong's zshrc file v0.2.1 and
# mako's zshrc file, v0.1
setopt ALL_EXPORT
DISABLE_AUTO_TITLE="true"
# Set/unset shell options
setopt notify globdots correct pushdtohome cdablevars autolist