Category Archives: Programming

Learn the Bash shell.

The poor Bash shell script. It gets lost in the flood of all the glitzy language wars, Python vs Ruby vs Perl vs Javascript… the list goes on and on, with new contenders seemingly rising from nowhere to get in the fight for developers attentions. Seldom do I hear anyone stick up for the poor… Read More »

How to run php inside a bash script

Yes…you CAN run a php script inside a bash script. (or any other programming language actually, inside a bash script). The syntax is shown below. Now I’m not sure that it’s always wise to do that, but it’s interesting that you can do that 🙂 I actually needed the output of a php script inside… Read More »

Simple Mysql Backup Script can be used with Crontab

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 – x=`mysql –user=root –password=REMOVED -B -e "show databases" | wc -l `; y=$((x-2)); for i in `mysql –user=root –password=REMOVED… Read More »

A few .bashrc functions

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… Read More »

Auto indenting php/html files with 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 🙂

Converting .wma files to .mp3 files

How to convert .wma files to .mp3 files. Requires, mplayer and lame for i in *.wma ; do mplayer -vo null -vc dummy -af resample=44100 -ao pcm:waveheader "$i" && lame -m j -h –vbr-new -b 160 audiodump.wav -o "`basename "$i" .wma`.mp3"; done; rm -f audiodump.wav