Skip to content

Instantly share code, notes, and snippets.

@goozbach
goozbach / 10-mkcd.sh
Created February 2, 2012 20:36
mkcd
# mkdir, cd into it
mkcd () {
mkdir -p -- "$@" && cd "$@"
}
@goozbach
goozbach / gist:1507318
Created December 21, 2011 19:26 — forked from sontek/snowjob.sh
Make your terminal snow
#!/bin/bash
LINES=$(tput lines)
COLUMNS=$(tput cols)
declare -A snowflakes
declare -A lastflakes
clear
@goozbach
goozbach / .gitignore
Created October 18, 2011 19:23
Inheritance/scope problem
*.sw[po]
*.pyc
@goozbach
goozbach / gist:1241507
Created September 26, 2011 02:38 — forked from travisbhartwell/gist:1239973
Yay Fun Hack
#!/bin/bash
# Don't allow unset variables
set -o nounset
# Exit if any command gives an error
set -o errexit
# Constants
LOG_DIR=$HOME/tmp
@goozbach
goozbach / directory
Created September 2, 2011 18:35
running a rpm compare.
$ ls
bc-1.06-1rt.x86_64.rpm bc-1.06-21.x86_64.rpm
bc-1.06-1rt.x86_64.rpm.output bc-1.06-21.x86_64.rpm.output
@goozbach
goozbach / bashrc.sh
Created August 25, 2011 23:02
profile.d in homedir
# source user definitions, only show output if $PS1 set
# to add a new one, drop it in ${HOME}/.profile.d/
if [ -d ${HOME}/.profile.d/ ]; then
# sourcing *.sh
for i in ${HOME}/.profile.d/*.sh ; do
if [ -r "$i" ]; then
if [ "$PS1" ]; then
source $i
else
source $i &>/dev/null
@goozbach
goozbach / iptables status
Created June 29, 2011 19:24
Iptables and Bind issue
Chain INPUT (policy DROP 5 packets, 277 bytes)
pkts bytes target prot opt in out source destination
79 8086 ACCEPT all -- lo any anywhere anywhere
464 92474 ACCEPT all -- any any anywhere anywhere state RELATED,ESTABLISHED
0 0 ACCEPT tcp -- any any anywhere anywhere tcp dpt:ssh state NEW
0 0 ACCEPT tcp -- any any anywhere anywhere tcp dpt:domain
0 0 ACCEPT tcp -- any any anywhere anywhere tcp dpt:http
0 0 ACCEPT icmp -- any any anywhere anywhere icmp echo-request state NEW,RELATED,ESTABLISHED
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
@goozbach
goozbach / ndb-local
Created May 19, 2011 18:49
Chaining PXELINUX bootloaders
ip=192.168.1.100 sys=laptop ether=001c25123456
dom=laptop.example.com
bootf=/386/syslinux/pxelinux.0
@goozbach
goozbach / pathcrement.py
Created March 8, 2011 18:30
Iterate over the entire path one part at a time.
#!/usr/bin/env python3
import os
mainpath = 'foo/bar/baz/qux/garple/sux/'
def incrementally_joined(parts):
full = ''
for p in parts:
full += p + os.sep
yield full
@goozbach
goozbach / makefile
Created February 1, 2011 20:49
Working with mmd 2 twiki xslt stylesheet
all: html view
@echo "Dude!"
view: source/foo.html xslt/stylesheet.xslt
xsltproc xslt/stylesheet.xslt source/foo.html | less -E
sjansen: source/foo.html xslt/sjansen.xslt
xsltproc xslt/sjansen.xslt source/foo.html | less -E
source/foo.html: source/foo.markdown