screen: split windows + how to use them

2008-12-19 Fri – 18:23:12 Screen allows you to create multiple sessions in which to execute processes (normally interactive shells, at least for me). The most common way of using these multiple shells is via the key bindings to switch between them (ctrl + a,<space> being the most common in my experience). Often, some windows are being monitored despite a low amount of activity - eg, IRC - so require the user to regularly switch to the window to check for activity (or when notified of activity in a particular window while viewing anotrher one). This can be a fairly annoying interuption to the flow of whatever you're doing in your "active" window, especially when you're simply flicking to a window to see what's changed, and then straight back again to continue whatever you were doing before. There is a way round this: screeen allows the creation of multiple viewing regions that can be set to display whichever window you like. Quick example session:
  (ctrl + a,: to bring up prompt for entering screen commands)
  :split              split current window into two regions
  :resize +20         grow the current region by 20 lines
  :focus down         move to the lower region

  (ctrl + a, until the desired window is visible)
  :focus up           move back to the previous region

  ... later, when the new region is no longer (des|requ)ired..
  :remove             remove the current region

RSS feed for friends' Twitter updates - in Google Reader

2008-12-07 Sun – 17:24:12

Hooray. I like keeping up with what my friends are up to, and add any weblog feeds I find to Google Reader whenever I come across one.

Recently I've realised how many of them are using Twitter, which I've signed up for but have no interest in using myself. So, it was kind of annoying to find out that while there is an RSS feed for each individuals' updates, the RSS feed that combined all my friends' updates together was password-protected.

This meant that rather than keep using Google Reader, to keep up with the all those Twitter updates I'd have to check Twitter itself - which truly doth sucketh.

However, problem solved! Not too complicated in the end really. Woo.

I've written a tiny script that uses curl to get a copy of the password-protected feed and runs from cron regularly and makes a local copy I can subscribe to in Google Reader:

Thankfully curl lets you use your .netrc file to specify the username and passowrd, and the Twitter feed is available over SSL, so it's even properly secure. Rah.

[jem:pgl]:~/scripts $ crontab -l | grep twit
 */5 * * * * twitter-friends-rss-update.sh
 
##~
 
[jem:pgl]:~/scripts $ cat twitter-friends-rss-update.sh
 #!/bin/bash
 
friendsrssurl='https://twitter.com/statuses/friends_timeline/14063001.rss'
localcopy="$HOME/p/twitter/rss/friends.rss"
 
/usr/bin/curl -s -n "$friendsrssurl" -o "$localcopy"
 
##~
 
[jem:pgl]:~/scripts $ curl --help | egrep -- '-[sno]/'
 -n/--netrc Must read .netrc for user name and password
 -o/--output  Write output to instead of stdout
 -s/--silent Silent mode. Don't output anything

wowmods: updates - user registration, favourites, more!

2008-12-07 Sun – 09:33:12

Hello,

and good day to you. I am writing this to let you know about a site I made. It's actually been around for a while, but hasn't changed much from its original (very much lacking) state after I stopped playing WoW nearly a year ago. Now that started playing again, I've finally gotten round to updating the website with some bits that I hope other people might find useful.

(This is actually a repost of the note I put up in the WoWAce forums - apologies for the duplication!)

It was originally written so I didn't have to check three places whenever I was trying to find an addon, or check for updates.

You can see it here:

Here's a quick overview:

  • lists updates to addons hosted on Curse, WoWInterface, and (*spit*) ui.worldofwar.net
  • updates available for previous hour, day, or three days
  • allows filtering by site
  • allows advanced filtering using Perlish regular expressions
  • supports favourites lists (for registered users)
  • can be accessed via an RSS feed (which should show the same list as set after configuring any filtering)
  • searchable database (8809 addons across all the sites so far) (I find this really useful when I can't remember where I saw an addon)
  • can be added as a Google Gadget to an iGoogle homepage
  • can be added as a Google Subscribed Link
  • supportsOpenSearch (at least, it should do!)
  • includes detailed information for each addon
  • where able, shows: links to sites able to be associated with the addon + changelogs + descriptions + details + update history + version numbers
  • easy-to-use/remember URLs? (nobody else is going to care about this, are they, heh :)

Here's some links in addition to the main page, if anyone's interested in having a look:

(Aside: just noticed ui.w are back to wowui.w - wtf? Another name change? Pff.)

It's not finished; there's lots more to do. But, now that there's finally favourites lists, I figured it might actually be useful for other people as well as me. :)

Any and all comments, criticisms, suggestions, and / or other similar communications, thoughts, opinions, and missives related, indirectly connected, or even nothing to do with the site are of course happily encouraged, welcome, desired, positively lusted over, and will find a soft warm home in my brain where they can relax with buttery toast and a nice cold alcoholic or non-alcoholic beverage of choice and the fine company amongst peers and friends.

cheers,

- pgl / Fin

bash: variable variables

2008-12-05 Fri – 21:54:12

How to use variable variables in bash:

[mimi:pgl]:~ $ tits=arse
[mimi:pgl]:~ $ arse=cheese
 
# this way I figured out myself after a long time pulling my hair out
[mimi:pgl]:~ $ echo ${!tits}
cheese
 
# this I found later at http://www.seocam.net/how-tos/how-to-create-variable-variables-in-bash
[mimi:pgl]:~ $ eval echo $`echo $tits`
cheese
 
# how to assign to a variable variable:
[vini:plowe]:~ $ tits=cheese
[vini:plowe]:~ $ arse=tits
[vini:plowe]:~ $ eval $arse='hello'
[vini:plowe]:~ $ echo $tits
hello

Explained -- obliquely -- in the manual:

   Parameter Expansion

   ...

       If the first character of parameter is an exclamation point, a level of
       variable indirection is introduced.  Bash uses the value of  the  vari-
       able  formed  from  the  rest of parameter as the name of the variable;
       this variable is then expanded and that value is used in  the  rest  of
       the  substitution,  rather than the value of parameter itself.  This is
       known as indirect expansion.  The exceptions to this are the expansions
       of  ${!prefix*} and ${!name[@]} described below.  The exclamation point
       must immediately follow the left brace in order to  introduce  indirec-
       tion.

("This is known as indirect expansion" - rubbish! Everyone calls it variable
variables! :))

YouTomb - archive of removed YouTube videos

2008-12-05 Fri – 15:52:12

Interesting:

YouTomb.

YouTomb is a research project by MIT Free Culture that tracks videos taken down from YouTube for alleged copyright violation.

Also: cool!

Play Auditorium

2008-12-01 Mon – 09:30:12

Interesting:

Play Auditorium

You proceed through the game by redirecting waves of light into targets by positioning things that divert the waves, with the levels getting more complex as you go on. There are "many ways to solve every puzzle"

This demo of Auditorium features 3 Acts. Each Act has at least 5 separate levels. We are currently working on the full version of the game and have estimated around 20 acts total to be released in the near future..

whois gateway finally fixed

2008-11-18 Tue – 01:41:11

Finally fixed my whois tool:

- http://pgl.yoyo.org/whois/

Previously, it arsed up on most domains due to overzealous sanitisation on my part. No longer! Hooray.

bash: arrays - assignment, looping, and indexing

2008-11-16 Sun – 03:40:11
## arrays in bash: assignment, indexing, and looping
##

# assign multiple values to a new array:
array=(tits arse)

# or:
array=([0]=tits [1]=arse)

# or:
array=([0]=tits arse)

# assign single values to specific indices:
array[2]='cheese'

# add a new value to the end of the array (push)
array+=(hmm)

# NB: indices do not have to be congiuous:
array[5]='last'

# view specific element of an array:
echo "first element: ${array[1]}"
echo "----"

# view number of elements in an array:
echo "${#array[*]} total elements"
echo "----"

# loop through an array by index:
for x in ${!array[*]}
do
        echo "\${array[$x]} -> ${array[$x]}"
done

echo "----"

# loop through an array by value:
for y in ${array[*]}
do
        echo $y
done

# ... or...
#for ((i=0 ; i<${#array[*]} ; i++))
#do
#       echo ${array[$i]}
#done


exit

## --
## output
## --

"test.sh" 67L, 1089C written
:!bash -D test.sh
:![ $? -eq 0 ] && test.sh
first element: arse
----
5 total elements
----
${array[0]} -> tits
${array[1]} -> arse
${array[2]} -> cheese
${array[3]} -> hmm
${array[5]} -> last
----
tits
arse
cheese
hmm
last

Reflection

2008-11-16 Sun – 02:37:11

Lovely image taken by Ricky Gervais where "the reflection of the room in the glass makes it look like a giant futuristic temple":

- http://www.rickygervais.com/images/tsott_nywindow.jpg


Double negatives

2008-11-13 Thu – 03:26:11

My favourite quote from bash.org:

#734797 +(3215)- [X]


<Malagmyr> This linguistics professor was lecturing the class.
<Malagmyr> "In English," he explained, "a double negative forms a positive. In some                    languages, such as Russian, a double negative is still a negative."
<Malagmyr> "However," the professor continued, "there is no language wherein a double                  positive can form a negative."
<Malagmyr> Immediately, a voice from the back of the room piped up: "Yeah..... right...."