This file contains 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 | |
# This script creates encrypted tarballs and then | |
# 1) Emails them to you, or | |
# 2) Uploads them to <fileconvoy.com>, and emails you a link and decryption key | |
# Dependencies: curl, openssl, grep, tar | |
# Where to find the content to back up | |
BACKUP_ROOT=/var/backup |
This file contains 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
" This minimal vimrc is intended to be easily deployed to machines where my | |
" dotfiles are not already installed, while maintaining a basic feature set | |
" for usability. | |
" These directories must exist... @{ | |
set backupdir=$HOME/.vim/backup " backup files location | |
set directory=$HOME/.vim/swap " swap files location | |
set tags=./tags,$HOME/.vim/tags " you probably want to add more to these later. | |
" }@ |
This file contains 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 | |
BASEDIR="${1:-./}" | |
listfiles () { | |
find ${BASEDIR} -type f -print0 | xargs -0 file -i -0 | grep -a "x-php" | cut -d '' -f 1 | |
} | |
listfiles | xargs grep -l "eval(" |
This file contains 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
# Generic data structure for mapping named arguments directly to properties | |
# More readable code than using dictionaries... | |
# Usage: | |
# mystruct = Struct(value1 = "x", value2 = "y", value3 = "z") | |
# print mystruct.value1 | |
# >> x | |
class Struct(object): | |
def __init__(self, **entries): | |
Struct.update(self, entries) |
This file contains 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 | |
git_command_context () { | |
cd $1; | |
shift; | |
is_workdir=`git rev-parse --is-inside-work-tree` | |
is_gitdir=`git rev-parse --is-inside-git-dir` | |
is_basedir=`git rev-parse --is-bare-repository` | |
my_gitdir=`git rev-parse --git-dir` | |
git "--work-tree=`pwd`" "--git-dir=${my_gitdir}" "$@" |
This file contains 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 | |
# Show duplicate files (compared by MD5 hash) | |
find ./ -type f -print0 | xargs -0 md5sum | sort | uniq -w 32 -D | |
# Remove smart-quotes from a buffer/file | |
sed "s/[”“]/\"/g; s/[’‘]/'/g" | |
# Rename a series of files (e.g. restore backups) by regular expression in OS X | |
find ./ -type f -name '*.bak' -print | sed -E 's/(.*)\.bak$/mv "&" "\1"/' > rename.sh |
This file contains 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 | |
# Python support for PERL's shorthand of pattern substitution (s/.../.../) | |
# Supports flags: | |
# i => case insensitive | |
# m => multiline match (caret and dollar represent line terminations, not whole-string) | |
# s => "dot-all" - dot matches everything, including new-line | |
# g => "global" - replace every instance (without this, only the first) | |
import re |
This file contains 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
## to encrypt | |
openssl aes-256-cbc -e -in plaintext.txt -out crypted.blob | |
## to decrypt | |
openssl aes-256-cbc -d -in crypted.blob -out plaintext.txt |
This file contains 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/bash | |
# VirtualBox control handler | |
# OS X shell context (BSD utilities) | |
# Simplifies VBoxHeadless and VBoxManage calls. | |
# In my use-case, the primary objective is to | |
# Usage: | |
# vm.sh list lists all your VMs |
This file contains 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
// This one only supports the '{0}' syntax for now... | |
function _format(p){var x = arguments;return p.replace(/\{([0-9]+)\}/g, function($0,n){ return x[1+Number(n)] })} |