This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
find ~/Library/Mail/RSS/ -name "Info.plist" -print0 | xargs -0 -I{} sh -c 'F="{}" ; defaults read "${F%.plist}" RSSFeedURLString' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MAKEFLAGS := -j | |
MDFILES := $(shell find . -name '*.md' -type f) | |
HTMLS := $(patsubst %.md,%.html,$(MDFILES)) | |
TEMPLATE := template.tpl | |
.PHONY: all clean | |
all: $(HTMLS) | |
%.html: %.md $(TEMPLATE) | |
theme -E -t $(TEMPLATE) -o $@ $< |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sqlite> select * from t1; | |
i n | |
a 1 | |
b 2 | |
c 3 | |
d 4 | |
e 5 | |
foo 15 | |
bar 37 | |
baz 115 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/make -rf | |
SELF := $(shell hostname -s) | |
.NOTPARALLEL: | |
.ONESHELL: | |
SHELL := /bin/sh | |
.SHELLFLAGS := -e | |
.PHONY: UPDATE_SOURCES ALL $(PACKAGES) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MAKEFLAGS = -j -s | |
HOSTGROUP1 = host1 host2 host3 host4 | |
HOSTGROUP2 = host10 host11 host12 | |
default: | |
echo available targets: all, hostgroup1, hostgroup2 | |
all: $(HOSTGROUP1) $(HOSTGROUP2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -e | |
cat $@ | tr -cs '0-9\.' '\n' | awk -F'.' 'NF==4 && $1 > 0 && $1<=255 && $2<=255 && $3<=255 && $4<=255 && !/\.\./' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# put this to your $HOME/.bashrc | |
# so you can safely use screen or tmux while preserving ssh-agent forwarding features | |
# of your ssh sessions | |
test "${SSH_AUTH_SOCK:-}" && test $SSH_AUTH_SOCK != $HOME/.ssh_auth_sock && { | |
test -L $HOME/.ssh_auth_sock && \ | |
test "$(readlink $HOME/.ssh_auth_sock)" = $SSH_AUTH_SOCK || \ | |
ln -sf $SSH_AUTH_SOCK $HOME/.ssh_auth_sock | |
export SSH_AUTH_SOCK=$HOME/.ssh_auth_sock | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os, fcntl, time | |
def locked(func): | |
def wrapper(*args, **kwargs): | |
with open('LOCKFILE','a+') as lf: | |
try: | |
fcntl.flock(lf.fileno(), fcntl.LOCK_EX|fcntl.LOCK_NB) | |
except IOError: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os, fcntl, time | |
from contextlib import contextmanager | |
@contextmanager | |
def lockfile(filename): | |
with open(filename,'a+') as lf: | |
try: | |
fcntl.flock(lf.fileno(), fcntl.LOCK_EX|fcntl.LOCK_NB) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -eu | |
usage () { printf "%s file [time-in-minutes]\n" ${0##*/} >&2 ; } | |
test $# -eq 0 && { usage ; exit 2 ; } | |
WHAT=$1 | |
test -e $WHAT || { echo "$WHAT not found" >&2 ; exit 2 ; } | |
MINUTES=${2:-30} | |
case ${0##*/} in | |
older*) | |
test $(($(date +%s)-$(stat --printf "%Y\n" "$WHAT"))) -gt $(($MINUTES*60)) |
OlderNewer