The Road to Elysium

September 16, 2010

Rapidshare Linux Script Revisited

Filed under: Linux — Tags: , , , , , , , , , — jorge @ 12:53

Update: I just added a new variable in the script, DAYS, which specifies how many days the cookie you create is valid for.
Update 2011-09-13: Seems Rapidshare have been tampering with their API, which made the cookie-generating script useless. I basically changed the getaccountdetails_v1 with getaccountdetails, and the script is working fine now. I’ve fixed the script below to reflect this.

The code to get the Rapidshare-cookie in my previous post about this subject, Rapidshare Linux Script, unfortunately doesn’t work anymore. It seems that Rapidshare has moved from using https://ssl.rapidshare.com/premzone.html to https://ssl.rapidshare.com/cgi-bin/premiumzone.cgi, so things just don’t work as they used to. This is for people with a premium account.

However, there’s a solution. First off, log in to your Rapidshare-account, go to Settings and make sure to check the box named Direct downloads, requested files are saved without redirection via RapidShare.

To grab the cookie you need, place the piece of code below in a file, save it, do a chmod +x on it. Just remember to replace MyUserName and MyPassword with your username and password before you run the script:

Note: The script requires curl to be installed.

#!/bin/bash
# Script to get your Rapidshare-cookie, nom nom
# Jorge Enrique Barrera
 
# Variables you can change
USERNAME="MyUserName" # Username to your Rapidshare premium-account
PASSWORD="MyPassword" # Password
COOKIEJAR="/home/jorge/.cookies" # Where the cookies are to be placed
DAYS="30" # The number of days the cookie is valid for
 
 
## Do not change anything below here ##
 
DATA="sub=getaccountdetails&withcookie=1&type=prem&login=$USERNAME&password=$PASSWORD"
COOKIE_STRING=$(curl -s --data "$DATA" "https://api.rapidshare.com/cgi-bin/rsapi.cgi" | grep cookie | cut -c 8-)
COOKIE=".rapidshare.com TRUE / FALSE $(($(date +%s)+24*60*60*$DAYS)) enc $COOKIE_STRING"
 
if [ ! -d $COOKIEJAR ]; then
        echo "Creating the directory $COOKIEJAR."
        mkdir $COOKIEJAR
        echo "Done."
fi
 
echo "$COOKIE" | tr ' ' '\t' > $COOKIEJAR/rapidshare

Now that the cookie is present, you can proceed by downloading the files you want. Which way you do that, is up to you.

Either way I will paste two scripts, one with wget and the other one with aria2, and you can then make your pick. Just place the URL of the files you want to download in /home/jorge/Downloads/.url, one in each line:

wget

#!/bin/bash
LIST="/home/jorge/Downloads/.url"
cd ~/Downloads
for url in `cat $LIST`
do
    wget -c --load-cookies /home/jorge/.cookies/rapidshare $url
done

Save this file as wrsd.sh and make it executable by doing a:

$ chmod +x wrsd.sh

aria2

#!/bin/bash
cd ~/Downloads
aria2c -j 5 -c --load-cookies=/home/jorge/.cookies/rapidshare -i /home/jorge/Downloads/.url

Enjoy. :)

September 14, 2010

Acer Aspire One USB Rescue Image

Filed under: Linux — Tags: , , , , , , , — jorge @ 09:10

A lot of people have been asking about where to find a rescue USB image for the Acer Aspire One. A long time ago someone with the nick gouki volunteered to host the file on a private server, but unfortunately, this is not so anymore.

I have placed the file on a new server, so you can now find it at http://jorge.fbarr.net/files/aa1_usb_recovery_image.gz. Right on the link and select Save link as to download it.

As for instructions on how to use it, I’ll repost a snippet of what I’ve written previously in the article Acer Aspire One Tips and Tricks:

I had to use an external USB drive for this, as I don’t have a USB-pen that’s above 125MB, but it works just the same. Besides the Acer One Aspire, I’ve another machine with Fedora 9 on it. Once the external drive was plugged in, this is what dmesg came up with:

usb 2-2.1: New USB device found, idVendor=1058, idProduct=0702
usb 2-2.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 2-2.1: Product: External HDD
usb 2-2.1: Manufacturer: Western Digital
usb 2-2.1: SerialNumber: 575845363037433636303733
usb-storage: device found at 14
usb-storage: waiting for device to settle before scanning
usb-storage: device scan complete
scsi 16:0:0:0: Direct-Access     WD       1200BEVExternal  1.02 PQ: 0 ANSI: 0
sd 16:0:0:0: [sdb] 234441648 512-byte hardware sectors (120034 MB)
sd 16:0:0:0: [sdb] Write Protect is off
sd 16:0:0:0: [sdb] Mode Sense: 00 00 00 00
sd 16:0:0:0: [sdb] Assuming drive cache: write through
sd 16:0:0:0: [sdb] 234441648 512-byte hardware sectors (120034 MB)
sd 16:0:0:0: [sdb] Write Protect is off
sd 16:0:0:0: [sdb] Mode Sense: 00 00 00 00
sd 16:0:0:0: [sdb] Assuming drive cache: write through
sdb: sdb1
sd 16:0:0:0: [sdb] Attached SCSI disk
sd 16:0:0:0: Attached scsi generic sg2 type 0

So now we know that the drive has been assigned /dev/sdb. Let’s make the recovery usb drive then.

WARNING: This next command will end up erasing your WHOLE drive, so be cautious when you type it. As root, type:

# zcat aa1_usb_recovery_image.gz > /dev/sdb

Notice that it’s /dev/sdb and NOT /dev/sdb1, as we’re overwriting the whole disk, and not just a partition of the disk.

That did the trick for me. Once the command was completed, remount the external drive and you’ll see that the new contents is there. Unmount it again, plug it into your Acer Aspire One, boot the machine, and press F12 during boot to select the USB-pen/external harddrive as the device to boot. You should be on your way towards recovery. :)

If someone happens to know how to do this in Windows, please give me a shout so that I can add it to this post. :)

A big thanks to Mithrandir for providing the file. :)

September 8, 2010

Spotify for Linux rpm

Filed under: Linux — Tags: , , , , — jorge @ 11:00

I’ve taken the liberty of converting the “Spotify for Linux”-files located at http://www.spotify.com/no/download/previews/ from .deb to .rpm. For now it can only be used if you have a Premium account.

To install it on Fedora 13, do the following:

su -
rpm --nodeps -Uvh http://jorge.fbarr.net/files/spotify-client-gnome-support.noarch.rpm http://jorge.fbarr.net/files/spotify-client-qt.i386.rpm

And that’s it. Now you can run Spotify as a Linux-application instead of through Wine. :)

August 27, 2010

Recommended Firefox addons

This post never gets old. I constantly keep finding new and useful addons for Firefox. Here’s the list of what I consider to be some of the best Firefox addons out there.

  • Adblock Plus
    • Ever been annoyed by all those ads and banners on the internet that often take longer to download than everything else on the page? Install Adblock Plus now and get rid of them.
  • MediaplayerConnectivity
    • Allow you to launch embed video of website in an external application with a simple click.
  • StartupMaster
    • Asks for the master password at startup (fixes multiple password prompt).
  • Tab Mix Plus
    • Tab Mix Plus enhances Firefox’s tab browsing capabilities. It includes such features as duplicating tabs, controlling tab focus, tab clicking options, undo closed tabs and windows, plus much more. It also includes a full-featured session manager.
  • Tiny Menu
    • Replace the standard menu bar with a tiny menu popup.
  • Xmarks
    • Xmarks is the #1 bookmarking add-on. Install it on all your computers to keep your bookmarks and (optionally) passwords backed up and synchronized. Xmarks also helps you uncover the best of the web based on what millions of people are bookmarking.
  • It’s all Text!
    • Right click on a text area, select “It’s All Text!” and edit the text in the editor of your choice.
  • Web Developer
    • The Web Developer extension adds a menu and a toolbar with various web developer tools.
  • BarTab
    • BarTab can intercept when tabs are loaded in the background or restored after a browser restart and will only load the content when the tab is actually visited. It also allows you to free memory by unloading already loaded tabs, either manually or automatically.

August 10, 2010

Introduction to irssi

Filed under: Linux — Tags: , , , , , , , , , — jorge @ 09:09

There are a load of IRC clients for UNIX-based systems out there, but I personally feel that irssi suits me best. Incredibly flexible, adjustable for every user, and doesn’t depend on X to be able to run it. Haven’t really found a guide out there that explains things in an easy and understandable manner, aimed particularly at new users. So here’s my attempt at it.

Table of contents

Getting started

What we need, of course, is irssi itself. You can get it at http://www.irssi.org/download, or use your system’s package manager to download it.

yum install irssi

..for RPM-based systems.

sudo aptitude install irssi

..for Debian/Ubuntu type of distributions.

Now, once installed, you can fire up irssi by typing

irssi

in the commandline. You should now be running irssi, whoo!

Customizing the settings

Now that irssi is up and going, you can change the settings, adjust it so that if suits you. By typing:

/SET <KEYWORD>

you will get a list of settings. For instance, let’s try out /SET nick. This is what pops up:

<09:07> [completion]
<09:07> completion_nicks_lowercase = OFF
<09:07> [lookandfeel]
<09:07> hilight_nick_matches = ON
<09:07> query_track_nick_changes = ON
<09:07> show_nickmode = ON
<09:07> show_nickmode_empty = ON
<09:07> show_own_nickchange_once = OFF
<09:07> [misc]
<09:07> netjoin_max_nicks = 10
<09:07> netsplit_max_nicks = 10
<09:07> netsplit_nicks_hide_threshold = 15
<09:07> [server]
<09:07> alternate_nick = joba7_
<09:07> nick = joba7

Here you see the various settings containing the word nick. irssi will automatically set your nick based on your account name. So if your username on your machine is foo, irssi will set your nick to foo. You can of course change this:

/SET nick joba7
/SET alternate_nick joba7_

..followed up by a /SAVE and /RELOAD to save and reload the settings.

Note: Every time you change a default setting, you will have to use /SAVE to save the configuration.

Connecting to an IRC-network

The usual way to connect to an IRC-network is to use /SERVER or /CONNECT. After having started up irssi, you can type:

/SERVER powertech.no.eu.dal.net

This will then connect me to the server powertech.no.eu.dal.net on the DALnet network. At the same time though, I’d like to be on the EFnet network. You can connect to multiple networks by typing:

/CONNECT irc.homelien.no

This connects you to the EFnet network as well. You are perhaps wondering how you can change from one network to the other? Look at your status-window. This is usually window number 1. Use ALT-1 or ESC-1 to change to that window. Right now my active network is EFnet, on the server irc.homelien.no. Which means that I’m seeing this:

[08:38] [joba7(+i)] [1:homelien (change with ^X)]

«Change with ^X» – ^X means Ctrl-X, so upon pressing it, you will change your active network. You will see something like this in your status window:

08:38 -!- Irssi: Changed to server powertech.no.eu.dal.net

To disconnect from one of the servers, or stop irssi’s attempt at reconnecting, use:

  • /DISCONNECT <network> – Disconnects server with tag network.
  • /DISCONNECT recon-1 – Cancels an attempt to connect to the server named recon-1.
  • /RMRECONNS – Cancels all attempts to reconnect.
  • /RECONNECT recon-1 – Will attempt to reconnect you to recon-1.
  • /RECONNECT ALL – Will attempt to reconnect to all the servers in the reconnection queue.

You can scroll upwards/downwards with the Page Up / Page Down keys. If they aren’t working for you, you can use Meta-p / Meta-n, where Meta can be ESC and/or ALT.

Default behavior is that irssi pretty much creates hidden windows for just about everything. Hidden windows are created every time you join a channel or start a conversation. There are different ways to switch between them:

  • Meta-1Meta-0- Switch between window 1-10.
  • Meta-qMeta-o – Switch between window 11-19.
  • /WINDOW <number> – Switch to window number <number>.
  • Ctrl-p / Ctrl-n – Switch to the previous/next window.

Adding networks, servers and channels

On the network DALnet you have a function called Nickserv, which lets you register a nick, so that you can become the owner of it. To be able to use this nick you will have to identify to it when logging on to the IRC network. It’s a bit tiresome having to type /nickserv identify <yournick> <yourpassword> every time you connect. I’m assuming you want this a bit more automated? I at least do. :) But before we do this we have to do a couple of things. Like adding a network:

/IRCNET ADD <YourNetwork>

For example:

/IRCNET ADD DALnet

If you’d like to execute a command when logging on, as in the example above with nick-identification, use -autosendcmd:

/IRCNET ADD -autosendcmd "/nickserv identify <YourNick> <ThePassword>;wait -DALnet 2000" DALnet

The command above automatically sends the identify-command to Nickserv when you log on. The -wait 2000 tells irssi to wait two seconds after having logged on to the server before sending the command.

Now that we’ve added a network, we need servers to go along with it. The command to do so is:

/SERVER ADD -ircnet DALnet powertech.no.eu.dal.net 6667

If you’d like to automatically connect to this server when you start irssi, simply add an -auto right after ADD. Specifying the port is optional.

So, first network, then server, now for a channel:

/CHANNEL ADD -auto #linuxhjelp DALnet [password]

[password] is optional, use of it depends on if the channel you’re trying to join needs a password to be accessed.

Logging

irssi has the ability to log both away-messages and regular conversations in channels. Logging for away messages is enabled by default, but not regular logging. First, it’s possible to define what the awaylog should log:

  • /SET awaylog_level MSGS HILIGHT – Defines what kind of messages to log.
  • /SET awaylog_file ~/.irssi/away.log – Defines the file the log should write to.

The easiest way of enabling logging, and not just away messages, is to execute:

/SET autolog ON

Per default irssi logs to ~/irclogs/<Servername or Networkname>/<Channel or nick>.log. This can be defined by:

/SET autolog_path ~/irclogs/$tag/$0.log

That is the default value. The path will automatically be created if it doesn’t exist. $0 points to the target (channel/nick). You can make irssi to automatically rotate the logs by adding a time/date stamp to the filename. You find more about the formatting used by typing man strftime in your commandline. But for example:

/SET autolog_path ~/irclogs/%Y/$tag/$0.%m-%d.log

%Y for year, %m for month and %d for day.

For more information about logging have a look at:

/HELP LOG

Scripts

If you’ve used other IRC clients, you’ve probably encountered the possibility to use scripts. Scripts can be used for various things, from showing a channel what song you’re currently playing to flaunting your machine’s hardware specs. A good site for scripts is http://scripts.irssi.org.

The scripts you download should be placed in ~/.irssi/scripts/. If the folder doesn’t exist, create it yourself. Once the script is placed there, you can load it in your irssi by doing a:

/SCRIPT LOAD ~/.irssi/scripts/TheScript.pl

This is a good approach if you don’t want certain scripts to load when irssi starts. If you do however want them to load when starting irssi, create a symlink in the folder ~/.irssi/scripts/autorun, just create the folder if it doesn’t exist. Symlink, what’s that? Well, it’ss a special type of file that contains a reference to another file or directory in the form of an absolute or relative path. So in other words:

cd ~/
wget http://scripts.irssi.org/scripts/splitlong.pl
mkdir -p ~/.irssi/scripts/autorun
mv ~/splitlong.pl ~/.irssi/scripts
cd ~/.irssi/scripts/autorun
ln -s ../splitlong.pl

So the file is really in ~/.irssi/scripts, but you’ve made a shortcut to it from ~/.irssi/scripts/autorun. Pretty neat if you ask me.

To unload a script simply use:

/SCRIPT UNLOAD <Name of script>

Minor adjustments

It’s not just what I’ve mentioned above that you can adjust and customize to your own liking. Another thing is the use of themes. You’re probably using the default blue theme that irssi comes with, which is just fine for my use, but perhaps not for you. I do however like the minor modification just for kicks.

Every time you use /SAVE, a message like this will appear in your status window:

08:38 -!- Irssi: Saved configuration to file /home/jorge/.irssi/config
08:38 -!- Irssi: Theme saved to /home/jorge/.irssi/default.theme

Settings are stored in the configuration file named config and the theme in default.theme. Both files are editable through a text editor. I’ve never really changed things manually in the config-file, but I’ve tampered with default.theme a bit, like what my own nick appears to me. Default appearance of your nick is like so:

< YourNick>

Where YourNick is in bold white, while the inequality signs are in gray.

Open the file ~/.irssi/default.theme and find the line that says something like:

ownmsgnick = "{msgnick $0 $1-}";

Change this to:

ownmsgnick = "%R<%n$0$1-%R>%n %|";

This will make the inequality signs turn red. Your nick will still be in white bold. But you can always change the inequality signs to something else. For instance:

ownmsgnick = "%Y(%n$0$1-%Y)%n %|";

Will make the parenthesis turn yellow. If you want to change the color of your nick, from default white to something else, find this line:

ownnick = "%W$*%n";

..and replace it with the color you want:

ownnick = "%G$*%n";

For a nice overview of colors, check out http://irssi.org/documentation/formats, and for more information about irssi, visit http://www.irssi.org/.

And here’s a screenshot of irssi:

Good luck!

« Newer PostsOlder Posts »

Powered by WordPress