Android FFMPEG converter
by M@ on Sep.07, 2009, under Scripts
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | #!/bin/bash # AUTHOR: M@sprackle.org # PURPOSE: To convert one file or many files to Android format and size. # LIMITATIONS: Get the Cancel button working in Zenity pop-up # INSTALL: Place this script in "~/.gnome2/nautilus-scripts/Android" # and set to execute `chmod +x ~/.gnome2/nautilus-scripts/Android` # USE: Just right click on a file or folder that contains files you # would like to convert to an Android format. This was converted from # my already used iPhone script. # # Where do you want all of these files to be saved? # You should NOT have to edit below this line SAVESPOT="/home/mwells/AndroidMovies" # # Same as above I just wanted a single place to find my files if [ ! -d $SAVESPOT ]; then mkdir $SAVESPOT fi # Lets see if this was a single file or a Directory if [ -f "$1" ]; then # # Let's cut up the name so it's not example.avi.mp4 NEWNAME=`echo "$1" | awk -F. '{print $1}'` # # Run the command - I found all these flags on some website. # So far they're good. ffmpeg -i "$1" -s 480x256 -vcodec mpeg4 -acodec libfaac -ac 1 -ar 16000 -r 13 -ab 32000 -aspect 3:2 -padtop 32 -padbottom 32 $SAVESPOT/"$NEWNAME".mp4 </dev/null # # Ta-Da else # # I placed the files in a new Directory to make them easy to find cd "$1" # # Lets find the files we want to work with. find . -type f -print0 | while read -d $'\0' file; do # # Lets check to see that this is a video file first file "$file" | egrep "video:" # # If the egrep returns a "0" it found the phrase "video:" then continue if [ $? != "0" ]; then exit 1 fi # Let's cut up the name so it's not example.avi.mp4 NEWNAME=`echo "$file" | cut -c 3- | awk -F. '{print $1}'` # zenity --text "Processing $NEWNAME" --info & # Run the command - I found all these flags on some website. # So far they're good. ffmpeg -i "$file" -s 480x256 -vcodec mpeg4 -acodec libfaac -ac 1 -ar 16000 -r 13 -ab 32000 -aspect 3:2 -padtop 32 -padbottom 32 $SAVESPOT/"$NEWNAME".mp4 </dev/null # zenity --text "$NEWNAME Complete" --info & # # Ta Da done # fi |
Parental Tech Support
by M@ on Jun.20, 2009, under Scripts
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | #!/bin/bash # AUTHOR - # M@ - M@sprackle.org GPG Public Key ID: 0x4ADEA413 # NAME - # HelpMe # SYNOPSIS - # Use as needed # DESCRIPTION - # This is just a script I wrote to help my mom and dad. Mom is on a # MAC these days and Dad is on a Fedora Core 11 laptop. So in order # to help them as needed I wrote this. # This uses port forwarding with SSH so that I can connect to port 8181 on my # local system and it actually goes to their local port X over the SSH tunnel. # This way they don't need to poke holes in the router/Firewall. # The MAC can use VNC but can't X-Forward # Fedora can do either but I prefer SSH # REVISIONS - # 1.0 # My Server/IP - I use my DDNS name to come home. SERVER='ddnsdomainfor.home.com' # SSH function SSH { ssh -L 8181:localhost:22 ${SERVER} } # VNC function VNC { ssh -L 8181:localhost:5900 ${SERVER} } # Ask what they would like echo " Would you like to enable SSH or VNC? " select APP in "VNC" "SSH"; do [ -z "${APP}" ] && echo "Please enter a vaild number" || break; done ${APP} |
Fun/bored with Torrents
by M@ on Jun.09, 2009, under Scripts
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | #!/bin/bash # AUTHOR - # M@ - M@sprackle.org GPG Public Key ID: 0x4ADEA413 # NAME - # fc11Downers # SYNOPSIS - # `*/20 * * * /PATH/TO/fc11Downers # DESCRIPTION - # Just a bittorrent downloader that would pull the Fedora Core 11 DVD when it dropped. # I was kinda bored and a co-worker and I joked about this so I thought it would be fun. # I think this would be interesting in a loop if you had a linux distro that updated weekly # and you wanted to get all the new versions off bittorrent each week. # I think version two will read in a file and loop it. For weekly linux distros only though, # those are legal on bittorrent. # REVISIONS - # 1.0 URLTOLOOK="http://torrent.fedoraproject.org" WHATTOPULL="Fedora-11-x86_64-DVD.torrent" # Check to see if the DVD has posted yet. links -source ${URLTOLOOK} > /tmp/site egrep ${WHATTOPULL} /tmp/site if [ $? == "0" ]; then if [ -f /tmp/${WHATTOPULL}.lock ];then exit fi egrep ${WHATTOPULL} /tmp/complete if [ $? != "0" ]; then exit fi touch /tmp/${WHATTOPULL}.lock bittorrent-console --save_in ~/Download --forwarded_port 7325 $(egrep ${WHATTOPULL} \ /tmp/site | awk -F"href=" '{print $2}' | awk -F\" '{print $2}') fi rm /tmp/${WHATTOPULL}.lock echo ${WHATTOPULL} > /tmp/complete |
dumstr – Subversion/Satellite Server script
by M@ on May.21, 2009, under Scripts
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | #!/bin/bash # AUTHOR - # M@ - M@sprackle.org GPG Public Key ID: 0x4ADEA413 # NAME - # dumstr = a Satellite used to map subterranean facilites and tectonic plates # http://www.satnews.com/cgi-bin/display_story.cgi?number=796520090 # SYNOPSIS - # ./dumstr # DESCRIPTION - # In order to check in and out files of Subversion and upload # them to a Red Hat Satellite Server configuration channel and be deployed # REQUIRMENTS - # This script assumes a certain setup of the subversion and # Satellite server. Example is below with a DNS server # Subversion server repositories are inside a ConfigChannels repo. # Within the ConfigChannel a repo for 'DNS'. # Within the DNS there could be multiple folders but for this assume 'ZONES' # The Satellite server would have a configuration channel called. # DNS-ZONES and inside are the zone files to be deployed to systems. # REVISIONS - # 1.0 # Subversion Server SUBVERSIONSERVER="https://svn.example.com/svn/repository/satelliteServer/ConfigChannels/" # Satellite Server SATELLITESERVER="satellite.example.com" # # Check to see that you have the rhncfg-manager RPM installed if [ ! -f "/usr/bin/rhncfg-manager" ]; then echo " You must have the rhncfg-management RPM installed. $ sudo up2date rhncfg-management" exit 1 fi # # Check to see that you have the subversion RPM installed if [ ! -f "/usr/bin/svn" ]; then echo " You must have the svn RPM installed. $ sudo up2date subversion subversion-devel " exit 1 fi # clear # Begin Function List # Check in files modified to the Subversion Server function CHECKITIN { echo " What local working copies would you like to check back in? (enter the number) ### " select LOCALSVN in `ls ~/subversion`; do [ -z "${LOCALSVN}" ] && echo "Please enter a vaild number" || break; done echo " Please select the subdirectory " select LOCALSVNSUB in `ls ~/subversion/${LOCALSVN}`; do [ -z "${LOCALSVNSUB}" ] && echo "Please enter a vaild number" || break; done echo " Please add a comment of why this file was changed. Hitting 'Enter' will submit." read COMMENTIN cd ~/subversion/${LOCALSVN}/${LOCALSVNSUB}/ svn commit -m "${COMMENTIN}" | tee /tmp/checkin export CHANNEL4ME=${LOCALSVNSUB}-${LOCALSVN} } # Check files out of Subversion function CHECKITOUT { echo " Getting Subversion channel lists, please wait. " select SVNCHANNEL in `svn list ${SUBVERSIONSERVER}`; do [ -z "${SVNCHANNEL}" ] && echo "Please enter a vaild number" || break; done clear echo " Looking further into your Channels. You may be prompted for a login and to accept the Subversion certificate. Please wait. . . . . . . . . Please select option Channel to download (enter the number) ### " select APIP in `svn list ${SUBVERSIONSERVER}/${SVNCHANNEL}/trunk`; do [ -z "${APIP}" ] && echo "Please enter a vaild number" || break; done clear if [ ! -d ~/subversion/${SVNCHANNEL} ]; then mkdir -p ~/subversion/${SVNCHANNEL} fi svn co ${SUBVERSIONSERVER}/${SVNCHANNEL}/trunk/${APIP} ~/subversion/${SVNCHANNEL}/${APIP} exit } # Satellite Server Uploads function SATELLITECALL { # Move to the directory we're working in. # This helps with pathing during uploads to the Satellite Server cd ~/subversion/${LOCALSVN}/${LOCALSVNSUB}/ for i in `egrep Sending /tmp/checkin | awk '{print $2}'` do #Push the files to the server sudo rhncfg-manager --server-name=${SATELLITESERVER} update \ --channel=${LOCALSVNSUB}-${LOCALSVN} --dest-file=/${i} ${i} if [ $? != "0" ]; then cd - echo "Commit failed Please try again" CHECKITIN fi echo " - - - RHN Push good - - - - There is a bug in the Satellite Server software - - Bug 467189 - Please check the permissions within the channel " done } # End Fucntion List # Ensure that a working folder exists for the user if [ ! -d ~/subversion ]; then mkdir -p ~/subversion echo " A new folder has been created in your home directory called 'subversion' All exports will be placed here" fi # What do you want dumstr to do echo " What do you need to do in subversion? (enter the number) ### " select CHECKION in "Check In" "Check Out"; do [ -z "${CHECKION}" ] && echo "Please enter a vaild number" || break; done clear # What do I do if [ "${CHECKION}" == "Check Out" ]; then # Call the Check out function CHECKITOUT elif [ "${CHECKION}" == "Check In" ]; then # Call the Check in function CHECKITIN if [ $? != "0" ]; then cd - echo "Commit failed Please try again" CHECKITIN fi cd - echo " - - Checkin good - - Would you like to update the files you've just checked in to the Satellite Server? " select YNMORE in "Yes" "No"; do [ -z "${YNMORE}" ] && echo "Please enter a vaild number" || break; done if [ "${YNMORE}" == "Yes" ]; then # If files are ready to be updated call Satellite function SATELLITECALL fi exit 0 fi rm /tmp/checkin unset CHANNEL4ME |
replaceAfriend script to annoy
by M@ on May.18, 2009, under Scripts
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | #!/bin/bash # AUTHOR - # M@ - M@sprackle.org GPG Public Key ID: 0x4ADEA413 # NAME - # replaceAfriend # SYNOPSIS - # ./replaceAfriend # DESCRIPTION - # I have a shirt from thinkgeek.com that says # "Go away or I will replace you with a very small shell script" # so I wanted to make that a true statement. I opted to pick random # lines in a few ways. # http://www.thinkgeek.com/tshirts-apparel/unisex/frustrations/374d/ # REVISIONS - # Only one published at this time. # LIMITATIONS - # You'll need to break this because it loops forever. # Here is the location of your file that has your friends favorite quotes FRIENDFILE='/home/username/.myfriends' # What's the Max interval(in seconds) you want to go without interuption INTERVAL='600' function annoyingloop { perl -le 'sleep rand ${INTERVAL}' sed -n $((1+$RANDOM%`wc -l ${FRIENDFILE} | cut -f 1 -d ' '`))p ${FRIENDFILE} | festival --tts annoyingloop } annoyingloop |
Content of .myfriends file
1 2 3 4 5 6 | hello friend how are you doing today, what's for lunch
Hey can I ask you a quick question
what time do you wake up?
Hey I just thought I would come over. Oh you look busy, what do you want to do for lunch?
Are you going to drink the rest of this coffee?
Quick question for you.. |
SSH Pub Key Scanner
by M@ on May.14, 2009, under Scripts
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | #!/bin/bash # AUTHOR - # M@ - M@sprackle.org GPG Public Key ID: 0x4ADEA413 # NAME - # sshKeyORama # SYNOPSIS - # ./sshKeyORama # DESCRIPTION - # A script to harvest all ssh public keys from a network # REVISIONS - # Only one published at this time. # LIMITATIONS - # TBD # IP class C to scan IPADDR='192.168.0' # Scan the entire class C for public keys for i in $(seq 254) do # Ensure that the host is live by looking up the IP in DNS. host ${IPADDR}.$i if [ $? == 0 ]; then # If DNS returns that the IP is listed then grab the public keys # You could kill the if then and just have the line below if you didn't care about dns. # ssh-keyscan -t rsa ${IPADDR}.$i >> ~/ssh_known_hosts ssh-keyscan -t rsa $(host ${IPADDR}.$i | awk '{print $5}') >> ~/ssh_known_hosts # This ssh_known_hosts file can be placed in /etc/ssh/ssh_known_hosts # every users will then get these keys in their local .ssh/known_hosts file fi done |
Master IPTables
by M@ on May.12, 2009, under How To
These are some awesome videos for iptables; I really enjoyed them and if you as well make sure you tell the guys over at Linux Journal.
I find embedded videos annoying so I’m just putting these links up.
Mastering IPTables by Linux Journal
http://www.linuxjournal.com/
IPA Link from Red Hat
by M@ on May.12, 2009, under How To
This is just a great video and link to the Enterprise IPA Server.
Red Hat IPA Server
RSYNC Laptop backup
by M@ on May.08, 2009, under Scripts
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | #!/bin/bash # AUTHOR - # M@ - M@sprackle.org GPG Public Key ID: 0x4ADEA413 # NAME - # lappyVonRsync # SYNOPSIS - # `15 1 * * * /home/username/scripts/lappyVonRsync` # DESCRIPTION - # To keep my NFS share in sync with my laptop ~ # REVISIONS - # Only one published at this time. # LIMITATIONS - # I only allow the sync to occur if my laptop is hard wired and on my internal network. # My home HOMEDIR="/home/username/" SHARENAME="/Share/username" SERVER="192.168.227.254" # Look at the eth0 to see if the system is on my internal network. /sbin/ifconfig eth0 | egrep "192.168.227" # Since it is start the rsync. if [ $? == "0" ]; then # rsync command rsync -vaz --exclude-from="${HOMEDIR}.rsync/exclude" -e ssh --delete ${HOMEDIR} ${SERVER}:${SHARENAME} fi |
WP e-commerce script
by M@ on May.02, 2009, under Scripts
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | #!/bin/bash # AUTHOR - # M@ - M@sprackle.org GPG Public Key ID: 0x4ADEA413 # NAME - # storemd5 # SYNOPSIS - # This should really go in your local users crontab # `*/20 * * * /PATH/TO/storemd5` # DESCRIPTION - # Because WP e-commerce does not work well with very large files. # This will allow you to upload the files using scp/ftp and then process them. # It's best to use a staging directory then move the completed files to 'upload' # REVISIONS - # Only one published at this time. # Define your web directory WEBDIR="/home/username/www/example.com" # Where is your store located STOREDIR="/home/username/www/example.com/wp-content/uploads/wpsc/downloadables" # Define your upload directory UPLOADDIR="/home/username/example-store/upload" # Check to ensure that folders needed are there if [ ! -d ${STOREDIR} ]; then mkdir -p ${STOREDIR} fi if [ ! -d ${SQLDIR} ]; then mkdir -p ${SQLDIR} fi if [ ! -d ${UPLOADDIR} ]; then mkdir -p ${UPLOADDIR} fi # In case of multiple files the for loop begins. for i in `ls ${UPLOADDIR}`; do # Change to the upload directory to just make it easier. cd ${UPLOADDIR} # Manipulate the file name NEWNAME=`md5sum $i | awk '{print $1}'` EXTNAME=`echo $i | awk -F. '{print $2}'` IDNAME=`echo $i | awk -F. '{print $1}'` # Pull your database information from the wordpress installation DBNAME=`egrep "DB_NAME" ${WEBDIR}/wp-config.php | awk '{print $2}' | awk -F\) '{print $1}'| cut -c 2- | awk -F"'" '{print $1}'` DBUSER=`egrep "DB_USER" ${WEBDIR}/wp-config.php | awk '{print $2}' | awk -F\) '{print $1}'| cut -c 2- | awk -F"'" '{print $1}'` DBPWD=`egrep "DB_PASSWORD" ${WEBDIR}/wp-config.php | awk '{print $2}' | awk -F\) '{print $1}'| cut -c 2- | awk -F"'" '{print $1}'` # Current date DATE4=`date +%D` # Move the file with it's new md5sum name to the web store mv $i ${STOREDIR}/${NEWNAME} # Insert the information about the file into the database. mysql -u ${DBUSER} --password=${DBPWD} ${DBNAME} <<EOF INSERT INTO wp_product_files (filename, mimetype, idhash, date) VALUES('$i', '${EXTNAME}', '${NEWNAME}', '${DATE4}'); EOF # Insert the information about the file into the database. mysql -u ${DBUSER} --password=${DBPWD} ${DBNAME} <<EOF INSERT INTO wp_product_list (name, publish, active ) VALUES('${IDNAME}', '1', '1'); EOF done |