Skip to content

Instantly share code, notes, and snippets.

#! /bin/bash
##############################################################################
# cleanlatex 0.1
# by Taurus Olson
# 1/02/09
#cleanlatex is a small program made in order to clean Latex directories full of useless files
# before removing them all he makes a backup directory that you can delete if you're sure it is safe
##############################################################################
directory=cleaned
@TaurusOlson
TaurusOlson / git-prompt.sh
Created February 25, 2011 12:56 — forked from bdougherty/gist:125113
My git bash prompt
# Functions for displaying git branch and status
function get_git_branch {
git branch | awk '/^\*/ { print $2 }'
}
function get_git_dirty {
git diff --quiet || echo '*'
}
function get_git_prompt {
git branch &> /dev/null || return 1
echo "[$(get_git_branch)$(get_git_dirty)] "
@TaurusOlson
TaurusOlson / pipl.bash
Created April 4, 2011 13:13
List python packages installed with pip
pipl () {
yolk -a | awk '{printf("%s (%s)\n", $1, $3) }' | grep -v pyobjc
}
@TaurusOlson
TaurusOlson / init_config.sh
Created April 21, 2011 23:01
Bash function to source config files and create aliases
# Usage: init_config CONFIG_FILE
# Description: Source the configuration file, and create an alias to edit it
init_config() {
local CONFIG_FILE=$1
if [[ -r $CONFIG_FILE ]]
then
source $CONFIG_FILE
CONFIG_ALIAS=".$(basename $CONFIG_FILE)"
alias $CONFIG_ALIAS="vi $CONFIG_FILE"
@TaurusOlson
TaurusOlson / .zshrc
Created April 21, 2011 23:03
My zshrc
export ZSH=$HOME/.zsh
# Usage: init_config CONFIG_FILE
# Description: Source the configuration file, and create an alias to edit it
init_config() {
local CONFIG_FILE=$1
if [[ -r $CONFIG_FILE ]]
then
source $CONFIG_FILE
@TaurusOlson
TaurusOlson / vg.vim
Created May 9, 2011 11:55
An alternative vimgrep
function! VG(pattern)
silent exe "vimgrep /" . a:pattern . "/ %"
silent exe "copen"
silent exe "setlocal cul"
endfunction
function! VGAdd(pattern)
silent exe "vimgrepadd /" . a:pattern . "/ %"
silent exe "copen"
silent exe "setlocal cul"
@TaurusOlson
TaurusOlson / tt.sh
Created June 6, 2011 13:57
tt - A simple shell function to handle multiple lists with t.py
tt () {
TASK_DIR=$HOME/tasks
if [[ $# = 0 ]]; then
t.py --task-dir=$TASK_DIR --list=tasks
elif [[ $# -ge 1 ]]; then
if [[ -f $TASK_DIR/$1 ]]; then
t.py --task-dir=$TASK_DIR --list=$*
fi
fi
}
@TaurusOlson
TaurusOlson / today.sh
Created August 25, 2011 11:20
Display the date in various formats
#!/bin/bash
[[ $1 -eq -1 ]] && today=`date +%m/%d/%y` && echo $today
[[ $1 -eq -2 ]] && today=`date +%m-%d-%y` && echo $today
[[ $1 -eq -3 ]] && today=`date +%d/%m/%y` && echo $today
[[ $1 -eq -4 ]] && today=`date +%d-%m-%y` && echo $today
[ $# -ne 1 ] &&
cat <<-EOF
Usage: today OPTION
@TaurusOlson
TaurusOlson / git_hist
Created December 15, 2011 13:10
Pretty git log
[alias]
hist = log --pretty=format:'%C(yellow)%h %C(blue)%ad %Creset| %s%Cred%d [%an]' --graph --date=short
@TaurusOlson
TaurusOlson / t.sh
Created March 6, 2012 16:54
Some functions using t.py for a project (list of the features and bugs)
bugs() {
t.py --task-dir . --list=ISSUES --delete-if-empty -g BUG
}
bug-new() {
t.py --task-dir . --list=ISSUES --delete-if-empty "BUG : $@"
}
bug-done() {
t.py --task-dir . --list=ISSUES --delete-if-empty --done -g BUG