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 | |
INCLUDE= | |
EXCLUDE= | |
COUNT= | |
while getopts ":i:e:m:ch" flag; do | |
case $flag in | |
i|include) INCLUDE="$OPTARG";; | |
e|exclude) EXCLUDE="$OPTARG";; | |
c|count) COUNT=1;; |
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 | |
WORDFILE="/usr/share/dict/words" | |
NUMWORDS=10 | |
#Number of lines in $WORDFILE | |
tL=`awk 'NF!=0 {++c} END {print c}' $WORDFILE` | |
for i in `seq $NUMWORDS`; do | |
rnum=$((RANDOM%$tL+1)); | |
sed -n "$rnum p" $WORDFILE; |
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 | |
if ! grep "GRUB_DEFAULT=saved" /etc/default/grub > /dev/null; then | |
sudo sed -i 's/^GRUB_DEFAULT=.*/GRUB_DEFAULT=saved/' /etc/default/grub | |
fi | |
echo | |
echo "== SELECT WHICH OS TO BOOT ==" | |
echo | |
sudo cat /boot/grub/grub.cfg | grep -oE "^menuentry '[^']+'" | awk -F\" '{print N++,$(NF-1)}' |
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"); |
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
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
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
#!/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
#!/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() { |
NewerOlder