my system-mutilating cleaning script
August 4, 2009 at 09:47 | Posted in Scripts | Leave a commentTags: cleaning, locate
#!/bin/sh
echo “updating slocate database…”
sudo updatedbecho “searching for and deleting instances of *.bak files…”
locate -i -r .bak$ | sed ‘s/ /\\ /g’ | sudo xargs rm -Rvecho “searching for and deleting instances of *.*~ files…”
locate -r ~$ | echo
# (I added this step because it would delete files like “~Final Fantasy VIII~” as well T_T)
read | echo “press enter to continue and delete files listed above”
locate -r ~$ | sed ‘s/ /\\ /g’ | sudo xargs rm -Rvecho “removing all found instances of Thumbs.db…”
locate -r /Thumbs.db$ | sed ‘s/ /\\ /g’ | sudo xargs rm -Rvecho “deleting contents of trash…”
sudo rm -Rv /home/susie/.local/share/Trash
sudo rm -Rv /root/.local/share/Trashecho “removing thumbnail cache…”
sudo rm -Rv /home/susie/.thumbnails
sudo rm -Rv /root/.thumbnailsecho “removing .serverauth files…”
sudo rm -Rv /home/susie/.serverauth*echo “deleting temporary files…”
echo “(note: will cause some programs to work improperly this session)”
sleep 2
sudo rm -Rv /tmp/*echo “re-updating slocate database…”
sudo updatedbecho “finished.”
exit
edit — Actually, I just read here that the .serverauth files can be prevented altogether.
the general uncommenting script!
July 13, 2009 at 12:52 | Posted in Scripts | Leave a commentthis is a learning process.
#!/bin/sh
cat $1|grep -v ^#
in action!
bash-3.1$ cat bin/wow
#!/bin/sh
echo "starting World of Warcraft"
#wine "/external0/tech/World of Warcraft/Wow.exe"
wine "/windows/Program Files/World of Warcraft/Wow.exe"
bash-3.1$ uncomment bin/wow
echo "starting World of Warcraft"
wine "/windows/Program Files/World of Warcraft/Wow.exe"
the all-encompassing network script
June 26, 2009 at 18:36 | Posted in Scripts | Leave a commentTags: networking
instead of having my computer attempt to connect to the internet whether it’s there or not, which causes it to lag as the dhcpcd times out, I wrote a handy dandy bash script :3
#!/bin/sh
echo “scanning for wireless connections…”
#displaying networks in range
iwlist wlan0 scan|grep ESSID#assign variables
HOMECHECK=`iwlist wlan0 scan|grep WirelessHomeNet`
HOMENET=” ESSID:\”WirelessHomeNet\”"
LSCHECK=`iwlist wlan0 scan|grep linksys`
LSNET=” ESSID:\”linksys\”"#check for home network
if [ $HOMECHECK == $HOMENET ]
then
echo “found home network, connecting…”
sh /root/homenet
ping -c 3 google.com
echo “done.”
else
echo “home network not found.”#check for linksys network
if [ $LSCHECK == $LSNET ]
then
echo “found linksys network, connecting…”
sh /root/linksys
ping -c 3 google.com
echo “done.”
else
echo “linksys not found.”
fifi
and what it’s doing here, is:
- scans for networks in range and displays them to me, because I like seeing these things for myself
- scans for networks in range again, and greps it for the string that indicates that it sees my home network’s ESSID, WirelessHomeNet, and saves that as the variable HOMECHECK
- compares the variable HOMECHECK to my preset variable HOMENET (which contains the string that indicates my network is in range), and if they’re the same, it will:
- execute the script I wrote to connect to my home internet
- ping google to show me the connection is good
but if they’re not the same, it will go about the same way, checking for a linksys connection, and then if it finds one,
- runs the script to connect to linksys
- pings google to verify the connection
Amazing, right? So in the end, if neither networks are available, it doesn’t run any of my network-connecting scripts, and therefore does not lag my computer at startup when this is run. :3
screenshot script
May 13, 2009 at 12:21 | Posted in Scripts | Leave a commentFor taking a screen shot of the screen after 3 seconds.
#/bin/bash
echo "Taking a screenshot..."
sleep 1 && echo "3..."
sleep 1 && echo "2..."
sleep 1 && echo "1..."
import -window root ~/screenshot-$(date +%F)--$(date +%T).png
switching between ati and fglrx graphics drivers
May 13, 2009 at 12:20 | Posted in Scripts | Leave a commentTags: ati, fglrx, xorg.conf
Firstly, save two extra copies of your xorg.conf. Configure one to use the ati driver, and save it as /etc/X11/xorg.conf.ati, and configure the other to use the fglrx driver and save it as /etc/X11/xorg.conf.fglrx.
For switching to the ATI driver:
#!/bin/sh
echo "Putting ATI driver in use..."
sudo cp /etc/X11/xorg.conf.ati /etc/X11/xorg.conf
killall X
For switching to the fglrx driver:
#!/bin/sh
echo "Putting fglrx driver in use..."
sudo cp /etc/X11/xorg.conf.fglrx /etc/X11/xorg.conf
killall X
And then after either of these, you’d have to start up x again. (startx)
For determining which driver is in use:
#/bin/sh
cat /etc/X11/xorg.conf | grep Driver | grep ati | grep -v ^#
cat /etc/X11/xorg.conf | grep Driver | grep fglrx | grep -v ^#
Blog at WordPress.com. | Theme: Pool by Borja Fernandez.
Entries and comments feeds.