Sudo Sandwich
-
Comments:
- here.
If you get this, you are probably nearly as nerdy as me. If you don’t, well, I’m not going to explain it. Whoops, forgot to add where this came from: xkcd.
If you get this, you are probably nearly as nerdy as me. If you don’t, well, I’m not going to explain it. Whoops, forgot to add where this came from: xkcd.
I’ve written a bit of code that works to automatically start any number of torrents placed into a specific directory. The way it’s set up at the moment is that it will only start the next one on the list, and you need to call it iteratively to start all of them. That’s mainly because on my NSLU2 I get some CPU usage issues if I start more than one at a time. Just have this script called every 5 mins or so in a crontab, and it will start every .torrent added to the source directory. */5 * * * * root /path/to/script/autoTorrent.py
I could make a resident version, that uses a time.sleep()
to call the main function every 5 minutes. Then this could be added to the /opt/etc/init-d/
directory.
#! /usr/bin/env python
import os, time
# Any .torrent file placed in $base/source will be downloaded.
# When it's complete, it will be moved from $base/work to $base/target
base_dir = "/home/user/torrent"
source_dir = os.path.join(base_dir,"source")
target_dir = os.path.join(base_dir,"target")
work_dir = os.path.join(base_dir,"work")
torrent_cmd = "enhanced-ctorrent"
torrent_args = "-S localhost:2780 >/dev/null &"
def getTorrents(path):
os.chdir(path)
data = os.popen("ls -1 *.torrent").read()
torrents = data.split("\n")[:-1]
for i in range(len(torrents)):
torrents[i] = os.path.join(path, torrents[i])
return torrents
def getNewTorrents(path, oldTorrents):
allTorrents = getTorrents(path)
newTorrents = []
for each in allTorrents:
if each not in oldTorrents:
newTorrents.append(each)
return newTorrents
def startTorrent(torrent):
os.chdir(work_dir)
cmd = " ".join((torrent_cmd, os.path.join(source_dir,torrent), torrent_args))
os.system(cmd)
#print cmd
def getRunningTorrents():
# do'h, ps on nslu2 is broken. Had to install procps.
cmd = "ps axwwo command | grep enhanced"
data = os.popen(cmd).readlines()
runningTorrents = []
for each in data:
if each.split()[0] == "enhanced-ctorrent":
runningTorrents.append(each.split()[1])
return runningTorrents
def startIdleTorrents():
torrents = getNewTorrents(source_dir, getRunningTorrents())
# since we get some CPU usage issues on starting several torrents at the same time,
# just start the first torrent in the list. Then we can rely on the idea we'll
# be called by a cron-job or something to start the next.
startTorrent(torrents[0])
if __name__ == "__main__":
startIdleTorrents()
I’ve finally installed my wireless router. I thought I’d do it now, even though at this stage I have no wireless devices. I did have some pretty serious troubles getting it all working. It uses a pretty straightforward wizard, but because my modem was set up to auto-dial, I wasn’t able to set it up initially. Finally, after resetting the router, and then the modem, and setting up the modem as a bridge, I was able to get the wizard to work. Tip: if your NetGear router has mistakenly identified the connection type as Static IP, or Dynamic IP, when it should be PPPoE, then you need to reset the router to factory settings to get it to work. You should also do this if you change connection type (ie, Cable to DSL, or vice-versa). This would have saved me heaps of time. Tip 2: don’t use a 7.5V supply if it should be a 12V supply. The router appeared to work fine, lights all came on and everything, but DHCP server didn’t run. Now to the problem I’m still having. The router has a DHCP server, but not a DNS server. So it gives out IP addresses, and reports the name of the device that has each IP address, but there isn’t a way to just visit a device by using that name. The modem-router setup I had previously did have a DNS server, which meant I could have each machine get an IP, and then use the name of the machine to connect to it. In the interim I’ve set up each computer with entries in the relevant hosts file (or equivalent), and I’ve given permanent leases to my machines. That will have to do.
I’ve just had my wireless router delivered, and I wanted to set it up without disconnecting from the internet for now. But when I try to connect to it, I get forwarded to the netgear website. Pissing me off…
I’ve been fiddling with Writely lately, and think it’s very cool. Online, shareable word processing. Even handles (relatively well) both revision control and concurrent editing. Not quite as well as, say, SubEthaEdit does live multi-person editing. Today, I also came across this: Google Spreadsheets.
Leaving on a Jet Plane • Chantal Kreviazuk • Armageddon ★★★★
There exists a small bug in Adium, which apparently has been fixed in an upcoming version, which means that hosted Gmail accounts cannot sign in as GTalk accounts. To fix it, I needed to create a new Jabber account, with the following settings: Account. Jabber ID: matt@schinckel.net Password: •••••••••••••••• Options. Connect Server: talk.google.com Resource: Adium Port: 5223 ☑ Force old-style SSL Then it connected fine, first time.
I wrote a fairly crappy iTunes rating program, but it always took up too much space for my liking. Today i came across a much nicer solution: (Courtesy of Josh Buhler.) The only bad thing is that it only allows for whole-star ratings. I’ll have to remake it so it can do half-star ones…
I’m having trouble posting with ecto. Seems to be a problem at my end, too. I can’t post at all anymore, it freezes after parsing the document. It used to post, and then get some sort of a fail on server connection, but I don’t even get that far now.
I’ve started using BitTorrent, or rather a couple of different clients, since I got ADSL, but what I really want is a fire-and-forget client for the NSLU2. This is what should happen.
There is a torrent ipkg for nslu2, which I’ve downloaded, but I may write my own. It’s show day tomorrow, so that might be a good start.
Test run on 29/08/2006 @ 9:55 PM Mirror: Optus Test type: ADSL Your connection speed: kbps: 209.77 KB/s: 26.22 Mbps: 0.21
Courtesty of Oz Broadband Speed Test.