Libervis Network - For a Free WorldLibervis Projects

Personal scripts

 Submitted by a thing on Thu, 2006-04-20 02:40.  
a thing's picture
Moderator
Posts: 864
Joined: 2005-12-20

Post your personal scripts here! I keep mine in /usr/local/scripts/, which is in my $PATH.

sizeof (obsoleted by fsize).

#!/bin/sh
if [ -z $1 ]; then
	echo "Error: no files or directories specified."
	exit 1
fi

for file; do
	if [ -d $file ]; then
		echo $(du -hs $file)$separator
	else	
		echo $(ls -lh $file|cut -d\  -f5) \($file\)$separator
	fi;
done

reset

#!/bin/sh
cd&&clear

Be sure to alias reset=". reset" or the cd won't do anything.
I have exit aliased to reset for /dev/pts/1, so the console on my desktop doesn't close.

swapclear

#!/bin/sh
su -c "/sbin/swapoff -a&&/sbin/swapon -a"

swap

#!/bin/sh
cp $1 ~/.temp
mv $2 $1
mv ~/.temp $2

inject

#!/bin/sh
eject -t $1

--

Disclaimer: My posts may change (dramatically) within the first 15 minutes they're posted.



 Thu, 2006-04-20 03:49  
supermike's picture
Writers Team
Posts: 471
Joined: 2006-02-17

Why /usr/local/scipts?

Why not /usr/lib/<your name>/scripts?

I dunno -- I'm at odds with wondering why /usr/local exists at all.

Anyway, here's mine:

bounceweb

#!/bin/bash
/etc/init.d/apache2 restart
/etc/init.d/postgresql-7.4 restart

bounceswap -- I use a swap file instead of a partition

#!/bin/bash
swapoff /swapfile
swapon /swapfile
cat /proc/swaps
--

When in doubt, follow the penguins.



 Thu, 2006-04-20 06:26  I use this one to switch
Posts: 767
Joined: 2006-03-28

I use this one to switch between PHP 4 and 5. Usually I work on five, but since most hosters out there still have 4 I have to test my stuff on that too, especially my classes which I always write for PHP5 and then backport to 4.

case $1 in
php4)
cp /usr/lib/php4.ini /usr/lib/php.ini
cp /usr/bin/php4 /usr/bin/php
cp /usr/local/apache/conf/httpd-php4.conf /usr/local/apache/conf/httpd.conf
cp /usr/local/apache2/conf/httpd-php4.conf /usr/local/apache2/conf/httpd.conf
/etc/rc.d/rc.httpd stop
sleep 2
/etc/rc.d/rc.httpd start
;;
php5)
cp /usr/lib/php5.ini /usr/lib/php.ini
cp /usr/bin/php5 /usr/bin/php
cp /usr/local/apache/conf/httpd-php5.conf /usr/local/apache/conf/httpd.conf
cp /usr/local/apache2/conf/httpd-php5.conf /usr/local/apache2/conf/httpd.conf
/etc/rc.d/rc.httpd stop
sleep 2
/etc/rc.d/rc.httpd start
;;
esac

Save MBR and partition table of a disk:

dd if=/dev/$1 of=$1.mbr count=1 bs=512
sfdisk -d /dev/$1 &gt; $1.sf

Restore MBR and partition table to a disk:

dd if=$1.mbr of=/dev/$1
sfdisk /dev/$1 &lt; $1.sf


 Thu, 2006-04-20 11:42  I've got a script that logs
libervisco's picture
Administrator
Posts: 3864
Joined: 2006-05-04

I've got a script that logs bandwidth spent via ppp network interface whenever I disconnect using a "hang" command I also made:

This is in /etc/ppp/ppplog/ppptraf.sh

It gathers ppp bandwidth information using ifconfig.

#!/bin/bash
# Traffic logger for ppp0 interface (both downstream and upstream)

cd /etc/ppp/ppplog/

# Add last traffic data to ppptraf.log in the same directory

ifconfig ppp0 &gt; ./ifconfig.tmp &amp;&amp; date &gt;&gt; ppptraf.log &amp;&amp; grep -i 'RX Byte' ifconfig.tmp &gt;&gt; ppptraf.log

# Add last traffic data to /mnt/data/ppp-traffic.log to last longer
# when switching between distros given that /mnt/data is your permanent data partition.
# Change the &quot;/mnt/data&quot; to your path. If you don't need this, comment it.

date &gt;&gt; /mnt/data/ppp-traffic.log &amp;&amp; grep -i 'RX Byte' ./ifconfig.tmp &gt;&gt; /mnt/data/ppp-traffic.log

# Report last traffic information to the screen and let me know it's done

echo &quot;----------------------------------&quot;
tail --lines=2 /mnt/data/ppp-traffic.log
echo &quot;----------------------------------&quot;
echo &quot;ppp traffic has been logged&quot;

exit

The hang command is simply a script located at /usr/bin/hang that looks like this:

GNU nano 1.2.5 File: /usr/bin/hang

#!/bin/bash
# Run connect command and the ppplog script

/etc/ppp/ppplog/ppptraf.sh

killall pppd

echo &quot;You are now disconnected!&quot;

exit

So it basically runs ppptraf.sh before killing pppd so that it logs the bandwidth information before it is lost.

Also, less significant is a hail command which I use instead of having to manually start both network interfaces whenever connecting to the internet (since I use both ppp and dvb interfaces, where ppp is for my EDGE modem and dvb is for my satelite card for satelite downstream connection).

So, the hail command starts both:

#!/bin/bash

echo &quot;Hailing internet...&quot;
/usr/bin/hail.sh &amp;
exit

calling hail.sh (because then hail can release terminal for other commands to be issued afterwards).

#!/bin/bash
# Run connect commands

/opt/tqrecv/start_satadsl.sh

pppd call edge

(probably not the sexiest solution, but hey..)

So, when I connect to the internet I usually just say "sudo hail" and I'm online. When disconnecting I say "sudo hang" and it logs my traffic from ppp to /mnt/data/ppp-traffic.log for my later inspection and kills ppp. DVB connection doesn't need to be killed however since it doesn't work without ppp anyway, it is just a satelite downstream used through a proxy.

I think this is pretty much the only meaningful thingie coming close to some sort of scripting/programming that I've done, except maybe for the libervis and nuxified site designs. Sticking out tongue

Cheers



 Sun, 2006-05-21 03:36  I have quite a few of them.
Posts: 33
Joined: 2005-12-20

I have quite a few of them. $HOME/bin is my preferred place. I'm not on my box so I can't post any of em. One of them takes a list of mp3/ogg files and burns a cd out of em, another cool one will take a command and log all output of it (stdout and/or stderr) to a file, very useful with startx. Can't really remember any more, I just make and use em without thinking about it. And many things other people would put into scripts are quite trivial for me so scripting it is a bother. And I can conjure up some crazy for and while loops too! I have rewritten quite a few utilities from coreutils and util-linux as shell scripts. Not much work to replace several MBs of bins with a couple KBs of POSIX compliant shell script. I wonder how many people realize how unnessecary the cat utility is...



 Sun, 2006-05-21 04:17  the scripts
a thing's picture
Moderator
Posts: 864
Joined: 2005-12-20
valan wrote:

I have quite a few of them. $HOME/bin is my preferred place. I'm not on my box so I can't post any of em. One of them takes a list of mp3/ogg files and burns a cd out of em, another cool one will take a command and log all output of it (stdout and/or stderr) to a file, very useful with startx. Can't really remember any more, I just make and use em without thinking about it. And many things other people would put into scripts are quite trivial for me so scripting it is a bother. And I can conjure up some crazy for and while loops too! I have rewritten quite a few utilities from coreutils and util-linux as shell scripts. Not much work to replace several MBs of bins with a couple KBs of POSIX compliant shell script. I wonder how many people realize how unnessecary the cat utility is...

Can you post the smaller ones and link to all of them?

--

Disclaimer: My posts may change (dramatically) within the first 15 minutes they're posted.



 Sun, 2006-05-21 11:55  some small scripts on my
free-zombie's picture
ModeratorWriters Team
Posts: 805
Joined: 2006-03-08

some small scripts on my home page:
http://jollybox.de/toolbox/index.en.php

and

#!/bin/bash
# any2xvid
output="${1%.*}.avi"
if test "$2" ; then output="$2";fi
echo -en "\033]0;any2xvid: converting $1 to $output\007"
mencoder -o "$output" -ovc xvid -oac mp3lame -srate 48000 -ofps 25 -xvidencopts bitrate=687 "$1"

useful for civilizing stray wmv9's



 Tue, 2006-06-06 06:14  Updated sizeof
a thing's picture
Moderator
Posts: 864
Joined: 2005-12-20

I updated my sizeof script to handle multiple files/directories.

--

Disclaimer: My posts may change (dramatically) within the first 15 minutes they're posted.



 Tue, 2006-06-06 22:25  For some reason I can't post
Posts: 84
Joined: 2006-01-02

For some reason I couldn't post them.. so I'll post later when I have them uploaded and linked here. Smiling



 Fri, 2007-05-11 19:44   dos2unix #!/bin/shsed -i
Posts: 84
Joined: 2006-01-02

dos2unix

#!/bin/sh
sed -i 's/\r$//' $1

initwifi.sh

#!/bin/sh

if([ "$1" = "1" ])
 then
  essid=belkin54g
elif([ "$1" = "2" ]);
 then
  essid=USR8054
  key=5275-7373-6F
elif([ -n "$1" ])
 then
  essid=$1
  if([ -n "$2" ])
   then
    key=$2
  fi
else
 echo "No preset, or ESSID set. Exiting.."
 exit 1
fi

modules=/opt/wifi
echo=/bin/echo
sudo=/usr/bin/sudo
iwconfig=/sbin/iwconfig
grep=/bin/grep
dhclient=/sbin/dhclient
bash=/bin/bash
prevdir=$(pwd)

cd $modules
$echo -n 'starting wifi .. '
$sudo sh -c "$bash wlan0down &> /opt/wifi/down.log"
$sudo sh -c "$bash wlan0up &> /opt/wifi/up.log"
until($sudo $iwconfig wlan0 2> /dev/null | $grep $essid > /dev/null)
 do
  $sudo $iwconfig wlan0 essid $essid
  $echo retrying ESSID
done
if([ -n "$key" ]); then
 until($sudo $iwconfig wlan0 2> /dev/null | $grep $key > /dev/null)
  do
   $sudo $iwconfig wlan0 key open $key
   $echo retrying WEP
 done
fi
sleep 1
$dhclient wlan0
$echo > /etc/resolv.conf
$echo "nameserver 208.67.220.220" >> /etc/resolv.conf
$echo "nameserver 208.67.222.222" >> /etc/resolv.conf
$echo done.
cd $PREVDIR

matrix.sh

#!/bin/bash

#echo $(sleep 5;echo) | cmatrix -b -s;

function printword {
 for i in $1
  do
   echo -n "$i"
   sleep .25;
 done
 
 echo -n " "
 sleep .5
}

printword "W a k e"
printword "u p,"
printword "N e o"


echo

mkscrn

DATE=`date +"%j_%H_%M_%S_%Y"`
FILENAME=~/images/screenshots/screenshot.$DATE.xinerama.png
scrot -d 5 -q 100 "$FILENAME"
rm ~/images/screenshots/newest.xinerama.png
ln -s "$FILENAME" ~/images/screenshots/newest.xinerama.png
echo "$FILENAME"

np

#!/bin/bash

PASS='rofl'
HOST='127.0.0.1'
PORT=6600

b=$(perl -e ' print chr(2) ')
v=$(perl -e ' print chr(22) ')
c=$(perl -e ' print chr(3) ')

status=$( (echo "password ${PASS}";echo "status";echo "close") | nc ${HOST} ${PORT} )
song=$( echo "$status" | grep ^song: | sed -re 's/song: //' )
bitrate=$( echo "$status" | grep ^bitrate: | sed -re 's/bitrate: //' )
songinfo=$( (echo "password ${PASS}";echo "playlistinfo ${song}";echo "close") | nc ${HOST} ${PORT} )
artist=$( echo "$songinfo" | grep ^Artist: | sed -re 's/^Artist: //' )
title=$( echo "$songinfo" | grep ^Title: | sed -re 's/^Title: //' )
album=$( echo "$songinfo" | grep ^Album: | sed -re 's/^Album: //' )
file=$( echo "$songinfo" | grep -i ^File: | sed -re 's/^File: //i' )

filename=$( basename "${file}" )
filedir=$( dirname "${file}" )

time=$( echo "$status" | grep ^time: | sed -re 's/^time: //' )

ctime=$( echo $time | sed -re 's/:[0-9]+$//' )
ttime=$( echo $time | sed -re 's/^[0-9]+://' )

function mktime {
 in=$1
 min=$(printf "%02.0f" $( echo "${in}/60" | bc -l));
 minc=$(printf "%.0f" $( echo "${in}/60" | bc -l));
 sec=$(printf "%02.0f" $( echo "${in}-(60*${minc})" | bc -l));
 if([[ "$sec" < 0 ]])
  then
  min=$( echo "${min} - 1" | bc -l )
  sec=$( echo "60 + ${sec}" | bc -l )
 fi
 printf "%s:%s\n" "$min" "$sec"
} 

currtime=$( mktime $ctime )
totaltime=$( mktime $ttime )

if ([[ -z "$title" ]]) && ([[ -z "$artist" ]]) && ([[ -z "$album" ]])
 then
  printf "np: ${b}%s${b} in ${b}%s${b} [${b}%s${b}/${b}%s${b}|${b}%sKbps${b}]\n" "$filename" "$filedir" "${currtime}" "${totaltime}" "${bitrate}"
elif ([[ -z "$artist" ]]) || ([[ -z "$title" ]])
 then
  printf "np: ${b}%s${b} in ${b}%s${b} [${b}%s${b}/${b}%s${b}|${b}%sKbps${b}]\n" "$filename" "$filedir" "${currtime}" "${totaltime}" "${bitrate}"
elif ([[ -z "$album" ]]) && ([[ -n "$title" ]]) && ([[ -n "$artist" ]])
 then
  printf "np: ${b}%s${b} by ${b}%s${b} in ${b}%s${b} [${b}%s${b}/${b}%s${b}|${b}%sKbps${b}]\n" "$title" "$artist" "$filedir" "${currtime}" "${totaltime}" "${bitrate}"
elif ([[ -n "$title" ]]) && ([[ -n "$artist" ]]) && ([[ -n "$album" ]])
 then
  printf "np: ${b}%s${b} by ${b}%s${b} from ${b}%s${b} [${b}%s${b}/${b}%s${b}|${b}%skbps${b}]\n" "$title" "$artist" "$album" "${currtime}" "${totaltime}" "${bitrate}"
fi

readnotes

#!/bin/bash
for i in nano.save*
 do
  (echo $i;echo ---------------;cat "$i";echo ---------------;) | less
  echo -n "Remove this file? [y/N]: "
  read ans
  if([[ "$ans" = "y" ]])
   then
    rm "$i"
  fi
done 

sys

#!/bin/bash
SEP=' '
BOLD=$(perl -e 'print chr(2);')
cpu=$(cat /proc/cpuinfo|grep "model name"|sed -re 's/model\s+name\s+:\s+(.*?)\s/\1/'|uniq|head -n 1)
upt=$(uptime|sed -re "s/\s*([0-9]+:[0-9]+:[0-9]+)\s+\w+\s+([0-9]+:[0-9]+|[0-9]+\s+\w+,\s+[0-9:]+|[0-9]+\s+\w+),\s+([0-9]+)\susers,\s+load\saverage:\s(.*?)\s*/[Uptime:(${BOLD}\2${BOLD})]${SEP}[Load Avg:(${BOLD}\4${BOLD})]${SEP}[Users:(${BOLD}\3${BOLD})]/")
memfree=$(cat /proc/meminfo|grep MemFree|sed -re 's/MemFree:\s+([0-9]+)\s+kB\s*/\1/')
memtotal=$(cat /proc/meminfo|grep MemTotal|sed -re 's/MemTotal:\s+([0-9]+)\s+kB\s*/\1/')
hdd=$(df -h|grep -Ee '^/dev/(sd|hd)'|sed -re 's/\s+/ /g'|sed -re "s/^\s*(.*?)\s(.*?)\s(.*?)\s(.*?)\s(.*?)\s(.*?)\s*$/${SEP}[${BOLD}\1${BOLD}->${BOLD}\6${BOLD}:(${BOLD}\3${BOLD}\/${BOLD}\2${BOLD})(${BOLD}\5${BOLD})]${SEP}/")
mem=$(printf "${SEP}[Mem:(${BOLD}%smB${BOLD}/${BOLD}%smB${BOLD})(${BOLD}%s${BOLD})]" "$(echo "scale=1;(${memtotal}-${memfree})/1024"|bc -l)" "$(echo "scale=1;${memtotal}/1024"|bc -l)" "$(echo "scale=1;((${memtotal}-${memfree})/${memtotal})*100"|bc -l)%")
printf "%s%s%s%s%s%s" \
 "[Host:(${BOLD}${HOSTNAME}${BOLD})]${SEP}" \
 "[OS:(${BOLD}$(uname -o), $(uname -mr)${BOLD})]${SEP}" \
 "$(echo "[CPU:(${BOLD}${cpu}${BOLD})]${SEP}"|sed -re 's/\s+/ /g')" \
 "${upt}" \
 "${mem}" \
 "${hdd}"

sizes

#!/usr/bin/env perl

# Formats output of du.
#
# example: $ du -sc * | sort -n | perl -e sizes
#
# output:
#
#  104.0000 kb rexima-1.4
#  101.3994 mb tremulous-1.1.0-installer.x86.run
#    1.1494 mb wrar37b3.exe
#    1.1041 gb arch
#
# written by spyro_boy / 

use warnings;
use strict;
while(my $num=<STDIN>) {
 my $i=0;

 # add more, I'm too lazy to search up all the acronyms
 my @units = ("b","kb","mb","gb","tb");

 if(my @m=($num =~ m/^([0-9]+)\s+(.+)/)) {
  my $size=$m[0];
  do {
   $size = $size/1024;
   $i++;
  } while($size>1);
  $size = $size*1024;
  printf "%10.4f %s %s\n",$size,$units[$i],$m[1];
 }
}

tinyurl

echo    "TinyURLing: ${1}"
echo -n "TinyURL   : "
wget -q -O - http://tinyurl.com//create.php?url=${1}|\
grep -iEe "block.*tinyurl"|sed -re 's/.*(tinyurl.com\/\w+).*/\1/g'|head -n 1

volume

if [[ -z "$1" ]]
 then
  vol=100
else
  vol=$1
fi
vols=($(amixer -c 0 sget PCM|grep -iEe '^\s*Front\s(Left|Right)'|sed -re 's/^\s*Front\s(Left|Right):\s\w+\s[0-9]+\s\[([0-9]+)%\]/\2/'));
amixer -c 0 sset PCM $[${vols[0]}+${vol}]%,$[${vols[1]}+${vol}]% > /dev/null

ytget

#!/bin/bash

# simply supplement this script with one argument: the youtube video identifier
#   Exmaple: http://youtube.com/watch?v=neAiLZcy8Qk
# The identifier in this link is the value right after ?v= which is neAiLZcy8Qk
#
# written by spyro_boy

if([[ -z "$1" ]])
 then
  echo -e "Yo dude! How am I suppose to know which video you want!? Jeez..\n\tusage: sh ytget.sh YOUTUBE_ID"
  exit 1
fi

ytid=$1

if((echo "${ytid}" | grep -Ee '(http://)(www.|)youtube.com/watch\?v=')&>/dev/null)
 then
  ytid=$(echo "${ytid}" | sed -re 's/^.*\?v=//')
fi

dldir=/home/youtube/
tmpfile=yttmp

if ! ([[ -d "${dldir}" ]])
 then
  mkdir "${dldir}"
fi

echo -n "Downloading video download information with id of ${ytid} from youtube.com.. "
wget -q "http://www.youtube.com/watch?v=${ytid}" -O ${tmpfile} && echo " done." || (echo -e " failed!\n Removing ${tmpfile} and Quitting!";rm ${tmpfile};exit 1)
title=$(cat ${tmpfile}|grep -i '<title>'|sed -re 's/^\s*<title>\s*//'|sed -re 's/\s*<\/title>\s*$//'|sed -re 's/^YouTube\s-\s//'|sed -re 's/ /_/g'|sed -re 's|/|_|')

# vars=$(grep new\ SWFObject ${tmpfile} | sed -re 's|^.*"/.*\?||' | sed -re 's|".*$||' | sed -re 's|&| |g' | sed -re 's|l=.*?\s||' )
vars=$(grep new\ SWFObject ${tmpfile} | sed -re 's|^.*"/.*\?||' | sed -re 's|".*$||' | sed -re 's|&| |g' )

for v in $vars
 do
  if(echo "$v" | grep -iEe "^video_id=" > /dev/null)
   then
    video_id=$( echo "$v" | sed -re 's/^video_id=//')
  fi
  if(echo "$v" | grep -iEe "^t=" > /dev/null)
   then
    t=$(echo "$v" | sed -re 's/^t=//')
  fi
done

# video_id=$(echo ${vars} | sed -re s'/\s+t=.*$//' | sed -re 's/^video_id=//') # BAD
# t=$(echo ${vars} | sed -re s'/^.*\s+//' | sed -re 's/^t=//') # BAD

link=$( printf "http://youtube.com/get_video?video_id=%s&t=%s" "${video_id}" "${t}" )

file="${title}-[${ytid}].flv"
if ! ([[ -e "${dldir}/$(basename ${file} .flv).avi" ]]) || ! ([[ -e "${dldir}/${file}" ]])
 then
  echo "Downloading video with id of ${ytid} from youtube.com.. "
  wget -c ${link} -O "${dldir}/${file}" && echo "Download complete!" || (echo -e " Download failed!\n Removing ${tmpfile} and Quitting!";rm ${tmpfile};exit 1)
fi
rm ${tmpfile}
prev=$(pwd)
cd ${dldir}
if ! ([[ -e "${dldir}/$(basename ${file} .flv).avi" ]])
 then
  echo "Encoding to xvid using mencoder.. "
   mencoder ${file} -ovc xvid -xvidencopts bitrate=1000:autoaspect -vf pp=lb -oac mp3lame -lameopts fast:preset=standard -o "$(basename ${file} .flv).avi" &&
   echo " done." || echo " failed!"
fi
cd ${prev}
if([[ -n "$2" ]] && [[ "$2" = "-play" ]])
 then
  echo "Playing video with mplayer.."
  if([[ -e "${dldir}/$(basename ${file} .flv).avi" ]])
   then
    mplayer "${dldir}/$(basename ${file} .flv).avi" &> /dev/null
  else
   mplayer "${dldir}/${file}" &> /dev/null
  fi
fi

/home/spyroboy/hacks/programming/bash/mkscreenshot.bash

#!/bin/bash

echo -n 5..;sleep 1
echo -n 4..;sleep 1
echo -n 3..;sleep 1
echo -n 2..;sleep 1
echo -n 1..;sleep 1
echo say cheese\!
DATE=`date +"%j_%H_%M_%S_%Y"`
FILENAME0=~/images/screenshots/screenshot.$DATE.0.png
FILENAME1=~/images/screenshots/screenshot.$DATE.1.png
DISPLAY=:0.0 import -window root $FILENAME0
DISPLAY=:0.1 import -window root $FILENAME1
rm ~/images/screenshots/newest.0.png
ln -s ~/images/screenshots/screenshot.$DATE.0.png ~/images/screenshots/newest.0.png
rm ~/images/screenshots/newest.1.png
ln -s ~/images/screenshots/screenshot.$DATE.1.png ~/images/screenshots/newest.1.png
echo "/home/spyroboy/images/screenshots/screenshot.$DATE.0.png"
echo "/home/spyroboy/images/screenshots/screenshot.$DATE.1.png"

/home/spyroboy/hacks/programming/bash/ripdrm.sh

if([ "$1" != "" ])
 then
  dir=$1
 else
  dir=cdrip_$(date +"%j_%H_%M_%S_%Y");
fi
prevdir=$(pwd)
mkdir ${dir}
cd ${dir}
for i in $(seq 1 $(echo QUIT | mplayer -quiet -slave cdda:// 2> /dev/null | grep 'Found.*tracks' | sed -e 's/[^0-9]//g'))
 do
  echo -n ripping track $i..
  mplayer cdda://${i} -quiet -cache 8888 -ao pcm:file=track_${i}.wav &> /dev/null
  echo done.
done
if([ "$2" = "ogg" ])
 then
  oggenc -q 10 track_*.wav
fi

if([ "$2" = "mp3" ])
 then
  lame --preset insane *.wav
fi
## I think this needs to be in a for loop; oh-well

cd ${prevdir}

/home/spyroboy/hacks/programming/bash/ripcd.bash

#!/bin/bash
cdda2wav -s -x -B -D /dev/hda
mkdir mp3
mkdir ogg
lame -q 0 -b 320 *.wav
mv *.mp3 mp3
oggenc -q 10 *.wav
mv *.ogg ogg
mkdir pcm
mv *.wav pcm
mkdir info
mv *.inf info

ERR... use these at your own damn risk! Some of these are probably disfunctional and incomplete.
*cough* yeah, I write a script for anything.
I have a lot more but they're more or less useless.



 Fri, 2007-05-11 19:54   This is the script I use to
dylunio's picture
Writers Team
Posts: 549
Joined: 2005-12-20

This is the script I use to find the sum total size of my server backups:

srvbksize.sh

#!/bin/bash
#
# Server Backup Size - srvbksize.sh
#
# Iestyn Pryce
# 25/04/07

IFS='
        '

PATH=/usr/local/bin:/bin:/usr/bin
export PATH

UMASK=002
umask $UMASK

PROGRAM=srvbksize.sh

DIR=~/backups

total=0

for f in `ls -al $DIR | grep -v "\-backup-" | fgrep backup- | sed s/' '/#/g |sed s/###/#/g | sed s/##/#/g | cut -d'#' -f 5 `
do total=$(expr $total + $f); 
done

# Make human readable as MB #
remainder=`expr $total % 1048576`
total=`expr $total / 1048576`

echo $total.$remainder MB is the sum total of your server backups 
--

Yn falch o ddefnyddio Linux a FLOSS!



 Sun, 2007-09-09 15:40  I need to reorganize my
Posts: 84
Joined: 2006-01-02

I need to reorganize my scripts directory. I've also updated a lot of them.. mm I'll get around to reposting them[, in a better fashion too].



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

We have 1733 members who wrote 2010 articles and 11728 comments. Welcome to our newest member, OldMan!

Who's online

There are currently 0 users and 17 guests online.
About | FAQ | Goodies | Link | Contact | IRC
Nuxified RSS feed
Welcome >  |  Need help? Register here and ask away! | Show what's new