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 | |
# | |
tivo_ip='192.168.1.1' | |
mak='1234567890' | |
in_dir='/path/to/videos/tivo_files/in' | |
out_dir='/path/to/videos/tivo_files/out' | |
useragent='Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1' | |
curl_opt="-v --location-trusted --digest -u tivo:${mak} -c cookies.txt --insecure" | |
# ============================================================================= | |
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 | |
# | |
for item in `find ./ -type f | sed -e 's/ /[SPACE]/g'` ; do | |
# unescape spaces | |
file_path=`echo $item | sed -e 's/\[SPACE\]/ /g'` | |
fi |
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 | |
# | |
# Extract File Extension | |
file_ext=${filename_or_path##*.} | |
# Extract File Name From Full Path | |
# This returns the file name given a full path: | |
file_name=${full_path_var##*/} |
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
/** | |
* @param unsortedRecords The array that needs to be sorted. This array must be in the typical | |
* format that our arrays are in after retrieving database data (i.e. array of records). | |
* @param sortKeys The record keys that we'll be sorting on. | |
* If this is an array, multi-column sorting will be done. | |
* @param sortDirections The direction to sort the columns. | |
* If this is an array, it should match up with the sort_keys array. | |
* @param sortTypes The type of sorting that should be done (SORT_NUMERIC, SORT_STRING, etc. ) | |
* If this is an array, it should match up with the sort_keys array. | |
* @example To sort records by 'last_name' in descending order: |
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 | |
# | |
# lsdup.sh | |
# | |
# create a hash table and look up items | |
# | |
# This script identifies duplicate files using their md5sum hash value. | |
# This can be done much easier in a language that supports hash lists such as PERL. I have done it in a shell script as both a proof-of-concept | |
# and to demonstrate the basic concept of storing/retrieving hash values and dealing with collisions. | |
# |
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 | |
# | |
shopt -s -o nounset # Option Explicit | |
# ============================================================================= | |
for ITEM in `egrep -l $* 2> /dev/null | sed -e 's/ /[SPACE]/g'` ; do | |
# unescape spaces | |
declare FILEPATH | |
FILEPATH=`echo $ITEM | sed -e 's/\[SPACE\]/ /g' -e 's/\n//g'` |
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 | |
# | |
# | |
printf "%s %s %s\n" "There are `find "$1" -type f | wc -l` regular files" \ | |
"taking up `du -sh "$1"|awk '{print $1}'` space" \ | |
"in folder "$1"" | |
exit 0 |
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 | |
# | |
SCRIPT=${0##*/} | |
if [[ $# -ne 1 ]] ; then | |
echo "usage: $SCRIPT filename" | |
exit 192 | |
fi | |
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 | |
# | |
# This script compares table counts in all databases | |
# from 2 servers. | |
# This is useful for finding replication issues. | |
# | |
use strict; | |
use warnings; | |
use DBI; | |
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 | |
# | |
# Create/Upack Tar File | |
tar -cvf dir.tar dir/ | |
tar -xvf dir.tar | |
# Create/Uncompress Tar.gz File | |
tar -cvzf dirs.tar.gz ./dir1 ./dir2 | |
tar -xzf dirs.tar.gz |
NewerOlder