Monthly Archives: May 2013

The new NAS build – in progress.

G.SKILL Ripjaws Series 8GB (2 x 4GB) 240-Pin DDR3 SDRAM DDR3 1600 (PC3 12800) Desktop Memory Model F3-12800CL9D-8GBRL

G.SKILL Ripjaws Series 8GB (2 x 4GB) 240-Pin DDR3 SDRAM DDR3 1600 (PC3 12800) Desktop Memory Model F3-12800CL9D-8GBRL

TOPOWER TOP - 800WS 800W ATX12V / EPS12V SLI Ready CrossFire Ready 80 PLUS SILVER Certified Active PFC Power Supply

TOPOWER TOP – 800WS 800W ATX12V / EPS12V SLI Ready CrossFire Ready 80 PLUS SILVER Certified Active PFC Power Supply

Intel EXPI9301CTBLK Network Adapter 10/ 100/ 1000Mbps PCI-Express 1 x RJ45

Intel EXPI9301CTBLK Network Adapter 10/ 100/ 1000Mbps PCI-Express 1 x RJ45

These are the parts for the new home NAS. Just put everything together tonight. Only thing left to install and buy is the drives πŸ™‚

Intel Celeron G1610 Ivy Bridge 2.6GHz LGA 1155 55W Dual-Core Desktop Processor BX80637G1610

Intel Celeron G1610 Ivy Bridge 2.6GHz LGA 1155 55W Dual-Core Desktop Processor BX80637G1610

 ASRock Z77 Pro4 LGA 1155 Intel Z77 HDMI SATA 6Gb/s USB 3.0 ATX Intel Motherboard


ASRock Z77 Pro4 LGA 1155 Intel Z77 HDMI SATA 6Gb/s USB 3.0 ATX Intel Motherboard

COOLER MASTER HAF 912 RC-912-KKN1 Black SECC/ ABS Plastic ATX Mid Tower Computer Case

COOLER MASTER HAF 912 RC-912-KKN1 Black SECC/ ABS Plastic ATX Mid Tower Computer Case

The NAS will run NAS4FREE once it’s completed. I’ll keep ya updated πŸ™‚

UPDATE:
Added 4 3TB drives and installed NAS4FREE … starting to take shape !

Simple Mysql Backup Script can be used with Crontab

mysql
This script backs up all databases on the server it’s running on. Usually ran as a cron job.

Hope someone else can use this as well.

#!/bin/bash
# Backup ALL mysql databases
# by crouse - https://crouse.us
x=`mysql --user=root --password=REMOVED -B -e "show databases"  | wc -l `; y=$((x-2));
for i in `mysql --user=root --password=REMOVED -B -e "show databases"  | tail -${y}`; do
mysqldump --opt --user=root --password=REMOVED $i | gzip -9 > /root/MYSQLBACKUPS/$i.`date --iso-8601`-mysqlbackup.gz
ls -t /root/MYSQLBACKUPS/$i.* | awk 'NR>7' | xargs rm -f
done
# Mail updates
touch sendthis
echo "" > sendthis
echo "Nightly Mysql Backup Information" >> sendthis
echo "---------------------------------------------" >> sendthis
echo " " >> sendthis
ls -la /root/MYSQLBACKUPS/ >> sendthis
cat sendthis | mail -s mail SOMEEMAIL@SOMEDOMAIN.com -s "Nightly Mysql Backup Notice"
rm sendthis
exit

A Bunch of new movies for 2013

My short list of movies to make sure I see in 2013 … ok, not so short… and the thing is, I’m not sure my wife would like even one of these !!!

Pacific Rim

Man of Steel

Star Trek – Into Darkness

Elysium

After Earth

Percy Jackson: Sea of Monsters

The Wolverine
https://www.youtube.com/watch?v=jWO-pavx9e0

Thor 2

World War Z

The Mortal Instruments

The Prototype

Jurassic Park IV
https://www.youtube.com/watch?v=XQCXVgX-GHo

Phantom

Gallowwalkers
https://www.youtube.com/watch?v=W37QoSb6Oms

Iron Man 3

White House Down

Hummingbird

Red 2

The Last Stand

Riddick 3
https://www.youtube.com/watch?v=PFCTPY536l8

Oblivion

Gi Joe 2 – Retaliation

A few .bashrc functions

bash Adding functions into your .bashrc file makes shortcuts available in your shell session by just typing the name of the function. These are just a few of the ones I have in my own .bashrc file, some are silly, some are useful πŸ™‚

# bu - A quick backup function
bu () { cp $1 ~/Backups/${1}-`date +%Y%m%d%H%M`.backup ; }
 
# hs - History Search
hs() {
history | grep ${1} | uniq --skip-fields=1 | sort -biz | uniq --skip-fields=2
}
 
# stock - Stock information search.
stock ()
{
lynx -dump β€œhttp://www.google.com/finance?client=ob&q=${1}” \
| sed β€˜s/.*’]'//’ | perl -00ne β€œprint if /Watch this stock/i”  \
| sed β€˜s/Watch this stock//’ | sed β€˜s/Disclaimer//’  \
| sed β€˜/^$/d’ | sed β€˜s/Currency in USD//’
}
 
# smallurl - create a shorter url link.
smallurl ()
{
lynx --dump http://api.fwd4.me/?url=${1}
}
 
# grepp - Imitate grep -p functions from Tru64 OS.
grepp ()
{
perl -00ne "print if /$1/i" < $2
}
 
# clock - A stupid clock function :)
clock ()
{
while true;do clear;echo "===========";date +"%r";echo "===========";sleep 1;done
}
 
# dirsize - Directory contents sorted by size.
dirsize ()
{
du -shx * .[a-zA-Z0-9_]* 2> /dev/null | \
egrep '^ *[0-9.]*[MG]' | sort -n > /tmp/list
egrep '^ *[0-9.]*M' /tmp/list
egrep '^ *[0-9.]*G' /tmp/list
rm /tmp/list
}
 
# extract - Extract most types of compressed files easily
# I think I found this one on the archlinux forums
extract ()
{
if [ -f $1 ] ; then
case $1 in
*.tar.bz2)   tar xvf $1     ;;
*.tar.gz)    tar xvf $1     ;;
*.bz2)       bunzip2 $1      ;;
*.rar)       unrar x $1      ;;
*.gz)        gunzip $1       ;;
*.tar)       tar xvf $1      ;;
*.tbz2)      tar xvf $1     ;;
*.tgz)       tar xvf $1     ;;
*.zip)       unzip $1        ;;
*.Z)         uncompress $1   ;;
*.7z)        7z x $1         ;;
*)           echo "'$1' cannot be extracted via >extract<" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
 
#############################################################
########### ENCRYPTION / DECRYPTION FUNCTIONS ###############
#############################################################
 
dc ()
{
# Passphrase decryption program
# Created by Crouse 10-20-2009
# Decrypts symetrically encrypted file to std out.
gpg --no-options --output .tempdc.txt "$1"
cat .tempdc.txt | less; rm -f .tempdc.txt
}
 
ec ()
{
# Passphrase encryption program
# Created by Crouse 01-13-2006
# Reads input from text editor and encrypts to screen.
clear
echo " "
echo "**************************************************";
echo "*         Passphrase Encryption Program          *";
echo "**************************************************"; echo "";
which $EDITOR &>/dev/null
if [ $? != "0" ];
then
echo "It appears that you do not have a text editor set in your
.bashrc file.";
echo "What editor would you like to use ? " ;
read EDITOR ; echo "";
fi
echo "Enter the name/comment for this message :"
read comment
$EDITOR passphraseencryption
gpg --armor --comment "$comment" --no-options --output \
 
passphraseencryption.gpg --symmetric passphraseencryption
shred -u passphraseencryption ; clear
echo "Outputting passphrase encrypted message"; echo "" ; echo "" ;
cat passphraseencryption.gpg ; echo "" ; echo "" ;
shred -u passphraseencryption.gpg ;
read -p "Hit enter to exit" temp; clear
}
 
# Passhprase edit encrypted file program
# Created by Crouse 11-02-2009
# Allow editing of symetrically encrypted files.
eedit ()
{
gpg --force-mdc --no-options --output .tempeec $1
emacs .tempeec
#vi .tempeec
gpg --armor --force-mdc --no-options --output $1 --symmetric .tempeec
shred -u .tempeec~ ;shred -u .tempeec ; clear
#shred -u .tempeec
}
 
enc ()
{
gpg --armor --no-options --output tempenc.txt --symmetric "$1"
mv tempenc.txt "$1"
}
 
dec ()
{
gpg $1
}
 
encnotes ()
{
echo "dc = decrpyt to screen"
echo "ec = encrypt to screen"
echo "enc = encrypt file to disk - overwrite existing"
echo "dec = decrypt file to disk - creates new file"
}

Auto indenting php/html files with vim

vim
Auto indenting php/html files with vim
Not really hard once you know how πŸ™‚


:set ft=phtml
gg=G


Vim is pretty cool, and can do some really interesting stuff if you take the time to learn how πŸ™‚