Programming

Scribes editor cheatsheet

Scribes editor cheatsheets This morning I decided to give Scribes another try. It has some great and cool features such a snippets (see the demo) and automatic word completion.
It also offers a pretty big set of keyboard shortcuts, some of them solve those little repetitive tasks you are used to if you edit a lot of code (like “free current line” or “free next line” to make space for more code).
So I thought a cheatsheet would be a good thing to start with and to have at hand. It took me a lot of time, expecially because I have been experimenting with a couple of tools I had never tried before, Scribus and Inkscape. I finally decided to go with the latter, as it gave me more ease of control on images.
I publish here the result for everyone to use. See further CC licence details clicking on the image below.
Get the cheatsheet from Flickr at different sizes or download the local copy (JPG 361KB).

Creative Commons License

This is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 License.

The need for a Tumblelog

“The bearing of a child takes nine months, no matter how many women are assigned.” Via A Billion Monkeys Can’t Be Wrong. I booked my flight for Barcelona for September. I have never booked a flight so much time ahead. By the way I am seriously considering to participate to the Erasmus program for next year.

Extreme Basherism

In the past you may have encountered this problem: looping through a list of files with a Bash “for loop” gave you headaches if filenames had spaces inside. This is our setting:

flevour@voyance:/tmp/blog_post$ touch "my filename with space"
flevour@voyance:/tmp/blog_post$ touch one two three other filenames
flevour@voyance:/tmp/blog_post$ ls -l
total 0
-rw-r--r-- 1 flevour flevour 0 2007-05-07 17:49 filenames
-rw-r--r-- 1 flevour flevour 0 2007-05-07 17:48 my filename with space
-rw-r--r-- 1 flevour flevour 0 2007-05-07 17:49 one
-rw-r--r-- 1 flevour flevour 0 2007-05-07 17:49 other
-rw-r--r-- 1 flevour flevour 0 2007-05-07 17:49 three
-rw-r--r-- 1 flevour flevour 0 2007-05-07 17:49 two

Now, the elite hacker that is in you wants to add a cool extension to all of these. Before getting your hands dirty with mv command, you cleverly echo the variables in the for loop so you know where you are going.
First try:

flevour@voyance:/tmp/blog_post$ for i in `ls`; do echo $i; done
filenames
my
filename
with
space
one
other
three
two

No luck. “Maybe”, you think, “I need to add the -1 (minus-one) switch to have each filename on a single line”, no luck anyway (feel free to try), The fact is Bash “for loop” parses input stream and stops as soon as it finds a “space”. Now if you surf a bit around you may find this solution that, although very compact and easy to remember, doesn’t satisfy your unconsciously deep need for deeper hackery hacknessity:

flevour@voyance:/tmp/blog_post$ ls | while read i; do echo $i; done
filenames
my filename with space
one
other
three
two

This solution correctly loops all the files. But I would like to show you a different approach that is obscure and great at the same time (found at LinuxQuestions):

flevour@voyance:/tmp/blog_post$ IFS=$'\n'
flevour@voyance:/tmp/blog_post$ for i in `ls`; do echo $i; done
filenames
my filename with space
one
other
three
two

Some remarks:

  • it’s generally suggested to backup the original content of IFS and restore it when you don’t need the different value anymore
  • IFS=$’\n’ looks strange to me, I don’t understand the need for the dollar sign. If you try with IFS=’\n’, you’ll get weird results. Any hackers out there can get the riddle an answer (Rionda? Riff Raff?)
  • after some brief researches it’s not clear if IFS modification and restore is seen as a good programming pattern
  • stands for Internal Field Separator

Of course the final script (we wanted to add extensions, remember?) would be:

flevour@voyance:/tmp/blog_post$ ifs=$IFS
flevour@voyance:/tmp/blog_post$ IFS=$'\n'
flevour@voyance:/tmp/blog_post$ for i in `ls`; do mv $i $i.1337; done
flevour@voyance:/tmp/blog_post$ IFS=$ifs

Enjoy your Bash hacking time!

Technorati Tags:

Oh he did it again ...

o n e Why_ has some super-natural powers … enter HacketyHack and teach progamming to your GranMa! (for more natural power showcase check out AlbeJTD latest photo here on the left)

Technorati Tags:

Gasp!

Triplefin.jpgAs a self-defined web2.0 enthusiast, this screencast leaves me wordless.

Getting better

Good luck to everyone who clicked on this! :o)Because good things can always improve.
My repaired laptop is ready to be collectec!

Technorati Tags:

XSLT definition

Teamwork?XSLT is extracoroporeal, a mental status, created by W3C on drugs”. Quote by the Chef. It made my day.

Technorati Tags:

Scared

Scared?No. Really. I mean it. My Firefox tabs set has never been so full of interesting and great tabs as today. Phishing attacks to OpenID. Too bad, I was so close to start using it. As a web-app wish-to-be-developer Slingshot leaves me wordless. You are probably “widly inefficient” at reading. Go double your reading rate. Highrise was released in a moment the need for such an app was strong in my life. So far I am liking it (it’s funny how you get to record unuseful stuff in clients’ profiles, such “client X told his mum lives in Y”, just because you can; I don’t think it’s totally useless anyway, in my experience people love when you remember details about them even after a long period of time).

Graph theory

This strip is simply hilarious, expecially when you read this right after a graph theory lesson. Via PDI^2.
Graph theory study wastes a lot of energy, so get yourself a Big Maaaaac! (Thanks AlbeJTD for this, I keep singing it, expecially when in pubs).

Technorati Tags:

Meanwhile

Meanwhile in no particular order: I started my career as Drupal teacher, I have been contacted by 3 different people in a range of 2 weeks for Drupal/PHP consulence, 2nd semester lessons began, I finally decided to bring my laptop to assistence (still a decision, but a firm one this time: infact I am using my old resurrected laptop with some directories binded from my external drive, too much fun), everyone around is writing Twitter is great (I haven’t tried it out, but I don’t feel like it’s my kind of site), I am trying to move away from my “alway keep Gmail/Gtalk on first tab in Firefox” habit toward a more concentrating environment featuring Evolution (an email client) and possibly Google Homepage with embedded Gtalk when needed.
EOP
PS: for auto-celebration’ sake (I know it’s nothing, but I love it):

root@family-laptop:/usr/local/bin# cat wd40
# override existing user homedir with mine (so permissions are preserved)
mount --bind /media/mybook/backup/flevour /home/family
mount --bind /media/mybook/backup/var/lib/mysql /var/lib/mysql
mount --bind /media/mybook/backup/var/www /var/www

Technorati Tags:
Syndicate content