Tips and Tricks About Computers, Web Development, Linux, the Internet and the Like
Software
If nvidia-settings cannot save to xorg.conf, do this
Feb 11th
If you’re using ubuntu and having trouble with nvidia-settings saving to the /etc/X11/xorg.conf file, you may find the following tip helpful in relieving that annoyance.
Looking for something interesting when I login to one of my servers, I decided to whip up the following script I appended to my ~/.bashrc file.
close nvidia-settings
in terminal:
sudo mv /etc/X11/xorg.conf /etc/X11/xorg.conf.backup sudo gedit /etc/X11/xorg.conf
paste the following:
Section "Device" Identifier "Configured Video Device" Driver "nvidia" EndSection
save and close.
back to terminal:
sudo nvidia-settingsand save the file.
Random cow(ish) animals preaching quotes on Ubuntu 9.10
Feb 3rd
Looking for something interesting when I login to one of my servers, I decided to whip up the following script I appended to my ~/.bashrc file.
# fortune and cowsay are needed for the snippet to work, I had to install these first sudo apt-get install fortune cowsay
COWDIR=/usr/share/cowsay/cows/; COWNUM=$(($RANDOM%$(ls $COWDIR | wc -l))); COWFILE=$(ls $COWDIR | sed -n ''$COWNUM'p'); fortune | cowsay -f $COWFILE
UPDATE:
Suggested by MrBougo, a shorter but perhaps more process intensive method:
fortune | cowsay -f $(ls /usr/share/cowsay/cows/ | shuf | head -n1)
Breaking down the script, the first 3 parts create variables and the last command executes the cowsay and quote.
# defines the directory of the cow files COWDIR=/usr/share/cowsay/cows/; # Get a random number limited to the number of files in the directory, making clever use of % (mod) and adding 1 to make sure it doesn't return 0 COWNUM=$(($RANDOM%$(ls $COWDIR | wc -l))+1); # list the contents of the cow dir again, pipe to sed and use the number as a random line to get the name of a file COWFILE=$(ls $COWDIR | sed -n ''$COWNUM'p'); # use fortune to get a quote, pipe to cowsay and use the file as defined above fortune | cowsay -f $COWFILE;
Using Nautilus Scripting Abilities to Integrate Right Click File Enqueues with mocp
Nov 8th
Using moc player can prove to be both beneficial and challenging. I’ve found myself going back to exaile for a few hours on random days for the simplicity in file management via a GUI. Since I prefer to use a single media player and mocp is light weight and helpful in so many other ways to me… I knew I needed a solution. It dawned on me just today how simple that solution could be with nautilus scripts.
#!/bin/bash # Enqueue with mocp # by Tyler "-z-" Mulligan # # This is a nautilus script. When placed in ~/.gnome2/nautilus-scripts # and chmod +x you will have the ability to right click >> enqueue files # or directories in mocp. # mocp -a "$@"
Some other tips… [ and ] silently skip back and forward respectively at a rate of 5sec per second held… this beats the left and arrows which work interactively at 1sec per sec.
? and h bring up the help, don’t forget this. Use this, learn the commands that work for you and happy listening.
Thanks to MrBougo again for helping me simplify the script further… I was originally using a for loop which is unnecessary as the quotes will help the variable expansion and mocp -a can accept multiple files/folders.
Reducing pageweight by compressing production css and js files
Sep 4th
I’ve been a little obsessed with improving the speed of web pages via minified javascript and css files. YUI’s team not only agrees with this, they recommend gzipping your minified js and css files. For a while I’ve been calling YUI Compressor inside my push to production scripts to do the deed. However, with this new mention of gzipping, I think might be exploring other options such as the method mentioned on the page which originally linked me to that awesome YUI writeup; minifying and gzipping javascript and css on the fly using php.
Installing Firefox 3.5.2 (Shiretoko) on Ubuntu using the default repos and customizing the icon to be more recognizable
Aug 30th
When Firefox 3.5 came out, I along with many others, was eager to try it. For a while I ran it out of the archive directly but this caused minor issues as it’s a messy solution. At some point I noticed firefox-3.5 in the repository:
tyler@quadjutsu:~$ apt-cache search firefox |grep 3.5 abrowser-3.1 - dummy upgrade package for firefox-3.1 -> firefox-3.5 abrowser-3.1-branding - dummy upgrade package for firefox-3.1 -> firefox-3.5 firefox-3.1 - dummy upgrade package for firefox-3.1 -> firefox-3.5 firefox-3.1-branding - dummy upgrade package for firefox-3.1 -> firefox-3.5 firefox-3.1-dbg - dummy upgrade package for firefox-3.1 -> firefox-3.5 firefox-3.1-dev - dummy upgrade package for firefox-3.1 -> firefox-3.5 firefox-3.1-gnome-support - dummy upgrade package for firefox-3.1 -> firefox-3.5 firefox-3.5 - safe and easy web browser from Mozilla firefox-3.5-branding - Package that ships the firefox branding firefox-3.5-dbg - firefox-3.5 debug symbols firefox-3.5-dev - Development files for Mozilla Firefox firefox-3.5-gnome-support - Support for Gnome in Mozilla Firefox
and proceeded to install it with the following command:
tyler@quadjutsu:~$ sudo apt-get install firefox-3.5
It runs along-side Firefox 3.0 without a hitch. I often use the two in tandem while testing web applications.
Something that bothered me about this was the default icon isn’t as recongnizable to me as I’d like it to be.
As such I looked into a way to replace it.
First, I found a replacement icon I liked
from the following website (where other nice replacements exist).
Then I went to find the logical location of the files to replace. First I updated my ‘locate’ database file because this software is new, so it’s not yet known. This is done automatically daily on a cron but you can update it any time you’d like as follows:
tyler@quadjutsu:~$ sudo updatedb
Then I probed for icons I might think would be responsible.
tyler@quadjutsu:~$ locate firefox |grep lib |grep icon |grep 3.5 /usr/lib/firefox-3.5.2/icons /usr/lib/firefox-3.5.2/chrome/icons /usr/lib/firefox-3.5.2/chrome/icons/default /usr/lib/firefox-3.5.2/chrome/icons/default/default16.png /usr/lib/firefox-3.5.2/chrome/icons/default/default32.png /usr/lib/firefox-3.5.2/chrome/icons/default/default48.png /usr/lib/firefox-3.5.2/icons/document.png /usr/lib/firefox-3.5.2/icons/mozicon128.png /usr/lib/firefox-3.5.2/icons/mozicon16.xpm /usr/lib/firefox-3.5.2/icons/mozicon50.xpm
The first set in the ‘/usr/lib/firefox-3.5.2/chrome/icons/’ folder will replace the icons used by the application itself (i.e. the icon in the top of your window). The latter, ‘/usr/lib/firefox-3.5.2/icons/’ will replace the ones used by shortcut icons.
Here are all the files for the icons I resized if you’d like to use them.
firefox-3.5_replacement_chrome_icons.zip
firefox-3.5_replacement_shortcut_icons.zip
bash pro-style:
cd Desktop/ && mkdir firefox_replacement_icons && cd firefox_replacement_icons wget http://www.doknowevil.net/files/firefox-3.5_replacement_chrome_icons.zip && wget http://www.doknowevil.net/files/firefox-3.5_replacement_shortcut_icons.zip for file in *.zip; do unzip $file; done sudo cp chrome/* /usr/lib/firefox-3.5.2/chrome/icons/default/ sudo cp shorcuts/* /usr/lib/firefox-3.5.2/icons/









