Archive for the 'Howto' Category

06
Jul
09

One command installation of Firefox 3.5 in Ubuntu

Psychocats posted a howto about how to install Firefox 3.5 in Ubuntu over here. It’s good, but it’s still not completely hands free. So I decided to make it a bit better. Copy and paste the following command into your terminal for Firefox-3.5 goodness.

Update | 8th July: Watch out, this will download the US version of Firefox only. If you’d rather have a version in your own locale, be sure to follow ol’ Psychocat’s version instead.

Code:
if [[ -e ~/.mozilla ]]; then cp -R ~/.mozilla ~/.mozilla.backup; fi; wget -c 'http://download.mozilla.org/?product=firefox-3.5&os=linux&lang=en-US' && sudo tar -jxvf firefox-3*.tar.bz2 -C /opt && rm firefox-3*.tar.bz2 && sudo mv /opt/firefox/plugins /opt/firefox/plugins.backup && sudo ln -s /usr/lib/xulrunner-addons/plugins /opt/firefox/plugins && sudo dpkg-divert --divert /usr/bin/firefox.ubuntu --rename /usr/bin/firefox && sudo ln -s /opt/firefox/firefox /usr/bin/firefox

All in one!

Advertisements
06
Jul
09

Bash aliases: check memory usage, package management, and more!

Check the memory usage of your favourite application in style. Grep the output of ps!

Code:
function ram() { ps auxf | grep $1 | grep -v grep | awk '{sum=sum+$6}; END {print sum+1023/1024}' ; }

Append the time and date to the start of your files.

Code:
function datestamp()
	{
	for x in $@; do
		if [ -e $x ]; then
			mv $x $(date +'%F')-$x
		else
			echo "$x? File doesn't exist, fool."
		fi
	done
	}

Install, remove, autoremove and purge. Now renamed Loadry, unloadry, laundry and nuke, respectively.

Code:
function loadry () {
        if [ $(whoami) != "root" ] ; then
           sudo apt-get install $@
        else
           apt-get install $@
        fi
      }

function unloadry() {
	if [ $(whoami) != "root" ] ; then
	   sudo apt-get remove $@
	else
	   apt-get remove $@
	fi
      }

function laundry() {
	if [ $(whoami) != "root" ] ; then
	   sudo apt-get autoremove $@
	else
	   apt-get autoremove $@
	fi
      }

function nuke() {
	if [ $(whoami) != "root" ] ; then
	  sudo apt-get autoremove --purge $@
	else
	  apt-get autoremove --purge $@
	fi
      }

For anybody who followed the Futurama tutorial, here’s a little something extra, just for you.

Code:
function woots() { #!/bin/bash
  cows=(/usr/share/cowsay/cows/*.cow)
  num=${#cows[@]}
  ((num=RANDOM%num))
  randcow=`echo ${cows[$num]}`
  if [[ $randcow = "/usr/share/cowsay/cows/leela.cow" ]] || [[ $randcow = "/usr/share/cowsay/cows/fry.cow" ]] || [[ $randcow = "/usr/share/cowsay/cows/bender.cow" ]];
    then futurama;
  else
    phrase=`fortune -a`
    cowsay -f $randcow $phrase;
  fi;
}

Ah shucks, maybe someone will find this nonsense useful some day.

05
Jul
09

Bash alias: look at an Experts Exchange article without having to pay

Experts Exchange often comes up when I’m searching for how to fix stuff. It’s annoying, because this site constantly tries to get you to pay for stuff and hides the actual content away as best it can. You don’t actually have to pay, though, to see the content. So here’s a Bash or Zsh alias for neatly avoiding all that:

Code:
function experts() { curl -s -H 'User-Agent: Googlebot/2.1 (foo)' $1 > $2.html && firefox $2.html; }

Change the ‘firefox’ bit to whatever browser you use (I’m on 3.5, yo!). Usage is simple:

Code:
experts http://link.to.experts.exchange.article.com filetosave

Don’t worry about including the .html bit, either. The file is saved to your current directory, just so you know.

04
Jul
09

Futurama ascii with Slashdot header quotes in your terminal

Fry, now with quotes!

Fry, now with quotes!

I know you want this. And here’s how. The tutorial even noobs can follow.

Continue reading ‘Futurama ascii with Slashdot header quotes in your terminal’




December 2017
M T W T F S S
« Aug    
 123
45678910
11121314151617
18192021222324
25262728293031

Stuff goes here

Hijack this blog

You want to use something from this blag? What the hell is wrong with you? Do you want to fail at life? If you reuse the crap I post here, people will say, "Wow, I never knew anybody could be so ignorant!" Then they will go and find a weapon to beat you with. That's right. There's your god-damned copyright notice. You really care about that shit? Fine. Take it, copy it, pretend it's your own work. Do whatever the hell you want with it, I don't care.

Blog Stats

  • 13,781 people hate me.