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 | |
branch=$1 | |
commitfile=$2 | |
ticketno=$(echo $branch | sed -r 's/[^0-9]+([0-9]+)[^0-9].*/\1/') | |
if [ -z "$branch" ]; then | |
echo | |
echo "Usage: $(basename $0) branch [ commitfile ]" | |
echo |
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
HASH= | |
FILE= | |
vimdiff <(git show $HASH~:$FILE) <(git show $HASH:$FILE) |
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
git remote prune origin | |
# or delete branches: | |
git branch --merged | grep -v "\*" | xargs -n 1 git branch -d |
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/perl | |
# download a page, and then download all the files on the page according to the regular expression, and store them in the folder | |
use strict; | |
use URI::URL; | |
my $urlchars = "[^\'\"]"; | |
parse("http://www.test.com/", "data-bt=\"($urlchars*?\.torrent)\"", "humble"); | |
sub parse() { |
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 | |
# isaac ALL = NOPASSWD: /home/isaac/.bin/sudo_envcat | |
pid="$1" | |
if [ "$pid" == 't' ] && [ $(whoami) == 'root' ]; then | |
exit 0 | |
fi | |
var="$2" | |
output=$(cat /proc/$pid/environ | tr '\0' '\n' | grep "$var" | cut -d '=' -f2-) | |
if [ -n "$DEBUG" ] && [ -n "$output" ]; then |
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
sudo touch /forcefsck | |
sudo shutdown -r 1 "shutting down to do disk check" |
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
for i in "$@"; do | |
temp="$(mktemp -d ./hardlnk-XXXXXXXX)" | |
[ -e "$temp" ] && cp -ip "$i" "$temp/tempcopy" && mv "$temp/tempcopy" "$i" && rmdir "$temp" | |
done |
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 | |
SHARE='/opt/shuttle' | |
FROM_FOLDER="$SHARE/Ready to Transfer" | |
TRANS_FOLDER="$SHARE/Transferred" | |
ERROR_FOLDER="$SHARE/Didnt Upload" | |
mkdir -p "$FROM_FOLDER" "$TRANS_FOLDER" "$ERROR_FOLDER" | |
# The idea is that files show up in $FROM_FOLDER, and are uploaded via ftp to the wordpress folder. | |
# If they transfer successfully, they're moved to $TRANS_FOLDER | |
# If they fail, they're tranferred to $ERROR_FOLDER |
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/perl | |
# | |
# Replaces a string within multiple files | |
# specified on the command line | |
$mv = '/bin/mv'; | |
$tmp = '/tmp'; | |
$op = shift || die("Usage: $0 perlexpr [filenames]\n"); |