Shanidar

Titular notícies
Nombre de resultats 16 per a Linux

13/03/2011 - Using Taskwarrior Instead Of Emacs+Org Mode For To-Do And Appointment Tracking
I have a confession to make: I'm not using emacs+org mode to keep my to-do list and appointments. What? The same emacs junkie that used emacs for (almost) everything last December gave up emacs? Yes, the same, but only gave up for this use case. I have some good reasons about why I am using TaskWarrior. Which does not mean that I could not be using emacs for the same, I just wanted to try something new.

TaskWarrior is very geeky

TaskWarrior as implied by the title of this post is a program you can use to keep a to-do list, appointments and project related lists of tasks. And is very geeky because it works from the command line. Yes, it is a task manager with a CLI (command line interface, as much as I love CLI's and acronyms, I had never used this one before!). And this is close to being the top in geekyness you can get.

You could get over the top and write your own task manager as a lot of people have done. In fact, I found about TW after learning about t, the python based minimalistic task manager, through finding t- in HackerNews, an even more minimalistic version of it.

Adding a task to taskwarrior is a little more simple than using org-mode, but this is just a matter of taste. You can add a task to an org file just by writing a line, whereas to add a task to TaskWarrior you issue task add task. Which I feel better about, it is the way it should be.

I want to use my Ben Nanonote for something

You probably remember my little pocket computer, the Ben Nanonote. It is a somewhat shiny little gadget, very lovely and for me, quite useless.... I have an iPod Touch and an iPad, what use can have a pocket-sized Linux based clamshell computer with Debian without X and 320x200 pixels?

At first, as part of my emacs 30 day challenge, I planned to use the Nanonote as an agenda, with emacs and org-mode. But this was hard to do: the keyboard has small keys and I have big fingers. I gave up, and almost stopped using it completely. Then, while on Switzerland I used the tiny beast to do some computations using Pari/GP and started to like it again. Although it lacks (mine, with my Debian installation) a good graphical plotter and visualiser (gnuplot does not work completely), it has yacas for symbolic algebra, Pari/GP for number theory and high precision computation and Octave. It also has C compiler... Forth, Lisp, Python, you name it. It is a nice gadget to keep close, but I wanted to use it for something. Here enters TaskWarrior, which fits like hand in glove with my Ben.

Using TaskWarrior (with screenshots)

I add whatever task is lingering in my mind as I wake up, like buying something for supper?, with task add task. List my tasks by issuing task (note: add alias t=task in your .bashrc!). This is because the default action (which can be customised) is list. You can change this (and a whole lot of other options), but this is out of the scope of this short introduction. Read the full TaskWarrior manual here.


Adding tasks, setting projects and so on

You can add projects, due dates, priorities and tags to a task with the keywords project, due, priority and tag, followed by a colon. Like task add Do something today due:today priority:H project:Hey +tag1. You add a + to a tag to decide whether adding a tag, +tagname or removing a tag, -tagname. To mark a task as done, you issue task #taskID done. And to find tasks matching some criteria, you should task list criteria. You can be more specific, with task list project:specificproject, or use some custom show function like task list complete. I know that TaskWarrior at first is a little verbose... but you can abbreviate: t add Tasktoadd pro:Aproject due:tom pri:L.


Advanced listing and adding

There is also a lot of possibilities to list tasks, task list limit:2 will show only 2 tasks, task next will show you what to do next (based on priority, due date and last time acted). Even more, you can create your custom reports! I did one that listed the what to work next with a minimal view (to fit the screen of the Ben Nanonote), and it is as simple as adding this to your .taskrc file:
#Custom report:
report.look10.description=Minimal next with due date
report.look10.columns=id,description,due,priority
report.look10.labels=ID,Description,Due,P
report.look10.sort=due+,priority-
report.look10.filter=depends.none: status:pending
report.look10.limit=10


Listing and custom reports

I also did a custom report that showed me 10 tasks marked as fun, i.e. with the tag +Fun added to them. Thus when I wasn't like working on real work, I could do some fun work. To learn how specific reports work, you can ask TaskWarrior to show them, like task show next:
Config variable Value
next 2
report.next.columns id,project,priority,due,active,age,description
report.next.description Lists the most urgent tasks
report.next.filter status:pending limit:page depends.none:
report.next.labels ID,Project,Pri,Due,Active,Age,Description
report.next.sort due+,priority-,active-,project+
urgency.next.coefficient 10.0
There are a lot more options to tweak, like color themes (TaskWarrior comes with quite a few, and you can write your own or download them from somewhere), adding task dependency, i.e. task 3 should only be done (and showed) after task 5, adding recurrence to tasks and quite a few more things. If you are interested in finding more about TaskWarrior, install it, play with it a little and start browsing the online tutorial.

My usage of TaskWarrior in the Ben Nanonote

I wake up, plug it to my MacBook, configure the network (see this post about Debian on the Ben Nanonote to read about networking it) and ssh from the Mac to it.

When I'm ready to go to my office, I unplug my Ben and head for my office. While on commute, I can check my tasks in the Ben or add one as needed just by taking it from my pocket. To save battery life I wrote two scripts named on and off, which just turn the screen on and off (the default timeout is way too long and with fbterm is hard to set up correctly, AFAIK) with echo 0 > /sys/devices/platform/jz4740-fb/graphics/fb0/blank

I get to my office, plug the Ben to my office computer, check for due tasks and work. When the day is over, unplug and head home... This way, it has always battery left, and my task list is always with me in a very browsable way. And I use my Ben for something!

All these reasons and use cases could work as well with org-mode. I could start emacs in my Ben at boot up, and work in the same way, but I wanted to try something different. So far, I'm very happy about how TaskWarrior works, and I was just happy with org-mode, mostly because org-mode works like a super organiser system. And I wanted something more minimalistic, for this specific aspect of my work-life. I.e., I won't be using vi without being forced to do it before hell freezes :).
The "Related posts" method I use involves Javascript, thus it doesn't work in the RSS feed. To view related posts, please refer to the original article. Thanks!



26/08/2010 - Get Yacas in the Ben NanoNote
Yacas is an advanced computer algebra system, with its own programming language and a lot of handful operators available.

It comes handy when you need to do that odd symbolic computation which is too big to handle by hand (or you are plain lazy).

By looking at the wikipedia entry, I discovered an startling truth: as of 2009, yacas is no longer maintained.

I should have guessed, because yacas does not compile out of the box (the program needed to generate the manuals does not compile), and this led to some naïve patching (just removing all instances of said program...).

The compilation process for the NanoNote with OpenWRT follows the usual lines, with a twist. Yacas uses a host program to generate code, named mkfastprimes. And when cross-compiling, the resulting executable cannot be used.

To solve this small problem, you need to compile yacas in your host computer, and use the generated mkfastprimes to get the desired files. To do so, in the makefile I download the package, uncompress it, configure and make. Some minor problem is that configure generates several makefiles and folders in the working directory... and looks like OpenWRT's makefile system does not allow to change it. Thus I copy the original Makefile to Makefile2, let configure generate a new one, make yacas and copy back the original Makefile.

And this can get you yacas working in the NanoNote. You can download the Makefile and patches from here.

For additional instructions on how to set up a build environment, please refer to Qi hardware's wiki here.

Related posts:
Gcal: the ultra-powerful command line GNU calendar
Unpacking my Ben NanoNote
My first port to the Ben NanoNote: gnugo
Another Ben Nanonote port: pmars
The "Related posts" method I use involves Javascript, thus it doesn't work in the RSS feed. To view related posts, please refer to the original article. Thanks!



10/08/2010 - Linux is a time killer
Preface: I have been using Linux since around 1998, when I installed Debian from scratch in my old Pentium II. I am more end-user than power user, but the computer I use most often (my netbook) has Linux in it by default. Also, my office computer is a Linux computer. And I am writing this in my MacBook. Which is not Linux, but at least it is Unix. What comes now is a personal rant, after a fight with my netbook. Probably not completely a Linux fault as an Acer one. But anyway, be warned this is a rant.



Linux is a time waster. It can come in two time-wasting fashion:
  • Good: you find a new command/application and play with it.
  • Bad: you try to configure something (or install a package from scratch).
I have nothing against the good part. I even enjoy it, by learning to use gcal, or a2ps. I even wrote a (guest) post on why I think learning these side tools can be rewarding.

But the bad part... this always gets on my nerves. I don't mean that Windows is better in the bad part... but Mac OS is. Mac OS just works, but they have the best thing to be that way: all Mac computers are Apple controlled. Thus they can test everything and say 'OK'. Every hardware part will work perfectly and smoothly with Mac OS version N.

Linux has to work in almost all strange configurations possible... And this means big hardware fuss. You have a winmodem? You can't use a dial-up connection (that happened in my Pentium II days). More recently, you have an internal SD card reader? You can't hotplug it.

All started with an upgrade from Ubuntu 9.10 to 10.04. I assumed dist-upgrade was a good option, I wanted to upgrade my distribution. Then I learned, and was advised that it was a bad idea... But how could I know it beforehand? It was the first time I had to upgrade, in my office this is automatic, and previously I had so little content that overwriting with a newer version was not a problem. It looked like the best tool for the job. The ~6 hours process began, and finally, ended.

Without keyboard, without trackpad, without USB. I had something similar to a brick, under X11. I could boot in console mode and tinker to solve it. I googled and digged into forums, and after around 2 hours I found some maybe solutions. Tried two (both took a while of editing) and they didn't work at all. Gave up (I remember fighting against X11 back in my pure Debian days, and it not enjoyable) and tried to download the latest Ubuntu to install from a Flash drive. Did you know that Ubuntu no longer gives system boot images you can write in USB flash drives? It is either net-install (but how do you boot it?) or CD. It looks like a good move in these days where netbooks have no CD drive. In case you are interested, you can find a flash drive image here.

This process started around 11 am and ended 11 am the day after. Then add quite a few more hours for installing all programs I use, and configuring a few of them. Luckily, I use fluxbox and emacs where configuration back-up is a dream.

Roughly two days for a system upgrade.

Then, the other day, I had some pictures I wanted to post somewhere. Don't remember exactly, and put my SD card in my right-hand internal reader. Nothing. D'oh! I remembered I had to enable hotplugging when booting, by adding some lines somewhere. Googled for a while, found the solution I used back in my 9.04 days.Which needed writing in a non-existent file. Duh. Ok, look for a solution for Ubuntu 10.04. More googling. Several tries (which mean edit, reboot and try). Nothing, I only got the LH reader working. The right one, which is the easily removable, the LH is an expansion slot, isn't. Just from upgrading from 9.10 to 10.04.

And it took me one other day.

These are just two of my everyday examples, and I guess you could share a few of your own. More if you are a sysadmin, or do something with web servers. Share your story, it will relax you. At least, I feel a little better.


The "Related posts" method I use involves Javascript, thus it doesn't work in the RSS feed. To view related posts, please refer to the original article. Thanks!



27/05/2010 - The command line PostScript swiss knife: a2ps
I discovered this tool by accident, when a colleague asked me why I printed a .txt file straight without using a2ps first. My first reaction of course was thinking What? and promptly asking google.

Google answered with this page, and it was interesting enough to deserve an apt-get install. And indeed, it is great! Usually, when I have some straight text file I need to print, I use emacs old postscript-print-buffer, which is nice, but not as nice as all options a2ps has.

As default, a2ps prints in landscape format, 2 pages per sheet. Moreover, it adds a black border around the page and a header with the filename, time and who printed this. Below an example of straight a2ps:



Back a few days ago I had to print my flight details (it was too early to print the boarding pass), and you know, they look like a nicely formatted text file. But when Gmail tries to print it, it removes all white spacing, rendering it unreadable.

A solution? Creating a flight.txt file and pasting from the mail. Then
a2ps flight.txt -B --portrait --columns=1 -o flight.ps
What does all this mean?
  • -B removes the header, which is useful only if more than one sheet is needed,
  • --portrait turns on portrait print mode (landscape by default),
  • --columns=1 Just one page per sheet. 2 by default,
  • -o output file name. By default it would send to the default printer,
And the same example with these settings:



There are also other interesting options. For example -catman (or -m) selects 66 lines per page, as if the job comes from a man page. A companion program to a2ps is card: turns man pages into pretty PostScript files. Its usage is simple:
card a2ps -o a2ps.ps
Generates the manual entry for a2ps for pretty printing:



The card program invokes a2ps, thus you can add a2ps options after --, for instance
card a2ps -o a2ps.ps -- -B to remove the headers



a2ps' slogan is Do the right thing, meaning that it will pass the processing to any other processor. For example, if trying to process html files, it will pass them to html2ps, if you try a gif file, it will pass it to ImageMagick.

This is only meant as an introduction to a2ps, as it has around 50 options for processing files. For more info... man a2ps :)

Related posts:
My first port to the Ben NanoNote: gnugo
Power to the command line
Two weeks, still loving Fluxbox
Three dee (3-dimensional file system browsers review)
Gcal: the ultra-powerful command line GNU calendar
Acer Aspire One 8.9' + Ubuntu + Fluxbox

The "Related posts" method I use involves Javascript, thus it doesn't work in the RSS feed. To view related posts, please refer to the original article. Thanks!



06/05/2010 - NanoNote ports: Yacas & 4th (Forth interpreter, compiler)
Last saturday I was in a porting mood, and tackled two interesting packages to have in the NanoNote: yacas and 4th.

Yacas (Yet Another Computer Algebra System) is a very interesting application to have in such a small device. The best calculator I have used is my old faithful HP49g. But in these days, it is bulky, heavy and slow. It was superseded by m48 (a HP48+ emulator) inside my iPod Touch. Quite nice: the HP48 is programmable, has graphing capabilities and quite a good computer algebra system.

However, the NanoNote is a computer. It has a fully featured (fully as in you can put whatever you want in it, if you are able to do so) operating system, and as such, can hold far more than a pocket calculator. And it has a real keyboard, not a fake touch keyboard as in the iTouch or a (horrible) plastic keyboard like the HP49g.

It turned out to be easier than I expected. The process needs a previous step, like Gnugo did. You have to compile it in your host system, and then use an intermediately generated file to cross-compile. I am almost done in writing a completely automatic Makefile that handles everything for you. As it stands, it is quite messy moving files around, but the program is usable.

The other, 4th is a multi-platform Forth interpreter and compiler. My first try of porting a Forth system was gforth, but it didn't work: gforth compiles itself (more or less), and in a cross-compilation process this is really hard to handle. The developers even acknowledge it in the INSTALL file.

Fortunately, 4th is easy to cross-compile on purpose and indeed, it worked like a charm. I didn't need to do anything more than write the Makefile and copying the libraries to the Nano afterwards. I'm also halfway writing a decent Makefile that copies these libraries where 4th can find them in the Nano.

Related posts:
Gcal: the ultra-powerful command line GNU calendar
Unpacking my Ben NanoNote
My first port to the Ben NanoNote: gnugo
Another Ben Nanonote port: pmars
The "Related posts" method I use involves Javascript, thus it doesn't work in the RSS feed. To view related posts, please refer to the original article. Thanks!



29/04/2010 - Linux screenshots made easy: Shutter & Screenie
Do you own a Mac? I use both MacOS and Linux everyday, and found myself with a problem. Before I found Shutter taking screenshots in Linux felt like a PITA. In MacOS you can take region screenshots by pressing Cmd-Shift-4. And I missed this feature in Linux, until I cared enough to look for a solution.

Shutter was the answer, an open source screenshot grabber that fills my needs, and probably yours too. Installing is relatively simple, if you have an updated version of Ubuntu. If not, you'll have to manually add the launchpad repositories. All instructions are on Shutter's homepage.

Once you have it running, you can take region specific screenshots, do some adjustments to them before you are ready to use your shot. It is simpler than opening The GIMP and editing. It was heaven when you write tutorials with screenshots. When you tap the cross for selection, the shutter screen automatically disappears and you can select the location you want to shot.



As a bonus, I found Screenie, which is a quick 2.5D compositor à la Apple KeyNote. I have used it for my post about porting pMars to the Ben NanoNote. It is easy to use, drag and drop and some sliders. Afterwards by right-clicking you can then export the image to PNG. You can see an example below.




Related posts:
My first port to the Ben NanoNote: gnugo
Power to the command line
Two weeks, still loving Fluxbox
Three dee (3-dimensional file system browsers review)
Gcal: the ultra-powerful command line GNU calendar
Acer Aspire One 8.9' + Ubuntu + Fluxbox
The "Related posts" method I use involves Javascript, thus it doesn't work in the RSS feed. To view related posts, please refer to the original article. Thanks!



24/04/2010 - sed (stream editor) to colorise script output
Yes, you can! Adding colors to terminal output is possible. You already know it, from ls --color In this post I show you a script that does it, in a simple way. I don't have a full range of colors implemented, but you can find all here.



This is the sed-processed output given by Gcal. The original source looks like



As you can see, I used as identifiers XML-like expressions. At first I just used odd punctuation marks (@, &, %...), but I realised it was too hard to remember. The script:
#\bin\bash

TEMP=calendartemp
TEMP2=calendartemp2
cat > $TEMP
#Change for dark blue
sed -e 's/.*<\/dblue>/ [1;34m& [0m/' -e 's/<\/dblue>//g' -e 's///g' $TEMP > $TEMP2
#Change for blue
sed -e 's/.*<\/blue>/ [34m& [0m/' -e 's/<\/blue>//g' -e 's///g' $TEMP2 > $TEMP
#Change for dark green
sed -e 's/.*<\/dgreen>/ [32m& [0m/' -e 's/<\/dgreen>//g' -e 's///g' $TEMP > $TEMP2
#Change for green
sed -e 's/.*<\/green>/ [1;32m& [0m/' -e 's/<\/green>//g' -e 's///g' $TEMP2 > $TEMP
#Change for red
sed -e 's/.*<\/red>/ [1;31m& [0m/' -e 's/<\/red>//g' -e 's///g' $TEMP > $TEMP2
#Change for dark red
sed -e 's/.*<\/red>/ [31m& [0m/' -e 's/<\/red>//g' -e 's///g' $TEMP2 > $TEMP
cat $TEMP > $TEMP2
sed -e 's/[0-9][0-9]:[0-9][0-9]./ [1m& [0m/g' $TEMP2 > $TEMP #White bold for hours
sed -r -e 's/[A-Z][a-z][a-z][0-9]{8,8}/ [33m& [0m/' $TEMP > $TEMP2 #Dark yellow for date
#Turn today's date into red bold
sed -e 's/.*<.*>/ [1;31m& [0m/' -e 's// /g' $TEMP2 > $TEMP
sed -e 's/ [0-9][0-9][0-9][0-9].*$/ [1m& [0m/' $TEMP #White bold for header
rm $TEMP
rm $TEMP2
You'll probably see some weird characters (if you don't, tell me!): these are escape characters. They are the ones that tell the terminal to output color. I can just copy-paste the above text into my editor and it gets converted to ^[ (but only as one character, not two!). If this does not happen to you, open a terminal, write echo " then press Control-V followed by esc, then " > escape.txt and you'll have the escape character in escape.txt. You can open this file and copy-paste it where needed.

The script is used just as a pipe:
setmana.x | Colorise.sh
where setmana.x calls gcal as I showed in my previous Gcal post. Now I only use it in the Gcal output, but I will probably use it somewhere else.

Related posts:
Three dee (3-dimensional file system browsers review)
Power to the command line
Gcal: the ultra-powerful command line GNU calendar

The "Related posts" method I use involves Javascript, thus it doesn't work in the RSS feed. To view related posts, please refer to the original article. Thanks!



15/04/2010 - Gcal the ultra-powerful command line GNU calendar
The Ben NanoNote has very few applications, as of now. And one it has (among a few nice others), is Gcal. I didn't know what Gcal was, and the Qi hardware wiki page on Gcal pointed me to this quite nice tutorial: The many uses of Gcal.

The tutorial is quite good, but somewhat long, and lacks a few specific examples, so I decided to write just what I read in that tutorial, mixed with the uses I am putting it to, so it is more a Gcal use cases than a full blown tutorial like that.

What can you use Gcal for? Gcal can be used for a lot of calendar related questions. A zillion calendar options (did you wonder what the old armenic months are?), more than you probably know about. Of course, if you are not a calendar freak, this is not the main selling point. Gcal works (and is intended to) as a diary, and appointment planner. It can also be used to determine sunset or sunshine in your local coordinates, and if you are an amateur astronomer, it can give you the twilight times. The same holds for data for the Moon, it can give you the moon phase, for instance.

Hey, its already the 21st century! Command line? I can hear you mumbling How come I have to use a command-line calendar?'Of course, if you are into really pretty UIs... Skip this article. This is more for the Unix/Linux user who just pops open a terminal and shouts gcal -f $mycalendar when he wants to know what today is due.

Ultra-portable & ultra-accessible. If you happen to have an ultraportable Linux thingy (like the NanoNote ;) you can carry your Gcal whenever you go. But if you have a fixed Linux box with Internet connection (at you office, at your server, wherever) you can ssh and run Gcal, from anywhere.

First steps: Installing and month displays: Well, the first step is to have gcal installed. If you are on a Linux box, it is quite easy, as it is in all repositories.
sudo apt-get install gcal
Now you can run it, to get a calendar view of the current month (gcal). You can also view three months (gcal .), or a full year (gcal 2010). The command -b N selects the number of month rows to display (gcal -b 4). You can also select a specific year, or range of months (gcal 3-5 2009). There is also an alternate month view (gcal -i). Below you can see this examples in a composition of terminal captures


Click to enlarge, and try by yourself!

Resource files: your calendar and more, much more. The crux of Gcal is its ability to work with resource files. In a typical resource file example.gcal (the name and extension are of your choice) you have something that looks like
0 This appears every day!
20100410 This only on 2010, April 11th
Your diary will be something like this. You may wonder if this is enough... But I haven't told you what you can write and what you can do with these date fields! Some more examples
2010apr01#99 All April
2010apr01#may99 April&May
2010aprsa1#sa9.7 April saturdays
The general notation for date ranges is date-identifier#final-date. Thus, we select the first day of April, and the event lasts until the 99th day, effectively marking all days of April. To mark all saturdays, a similar notation is used, but amazingly, a high number results in a error, please select 9 as in the sample. You can see a sample output in the following screenshot. You will also need to add .7, for each 7 days.


Click to enlarge

You can also see how to call Gcal to open a resource file: with either --resource-file or the -f commands. To display the fixed date list (i.e. what there is in the resource file) you need the -c command, and -cd or -ct would only list today and tomorrow, respectively. The command shown is -cdl@t55 which stands for show today and 55 days ahead starting from tomorrow.

You can find all range modifiers here.

Change of the date format. If you are a tinkerer, you probably don't like the default time representation. I don't I prefer to get output as YYYYMMDD without any separation. It can be easily pasted into file names to have them quickly sorted by date.

How to change it? As usual, you can invoke gcal with a change for that. An example could be --date-format='%>3w#K%1%Y%>02*M%>02*D%2' I can hear you saying d'oh! But it is not as bad as it seems. It breaks down as
%>3w#K 3 letters of the weekday
%1 Start highlighting
%Y Year number
%>02*M Fix 2 digits in month number
%>02*D Fix 2 digits in month day number
%2 End highlighting.
Not as bad as it looked like? You can find all descriptions for this here (bottom).


Click to enlarge

Change fixed date header list. That fixed date list heading is pretty ugly, don't you think? What happens when you call Gcal with --heading-text="%3 %Y %U %4"? You can see the output below. It makes for a more appealing view of events. To learn about heading modifiers, look here (and search for heading).


Click to enlarge

Sample script: sunset and sunrise times. You can save this in astronomical.gcal, and open when you want to know at which time the sun sets or shines. There are a lot of related options, learn more about sun/moon modifiers here. You will need to know your latitude/longitude.
; latitude 41.4798
; longitude 2.3188 for gcal add 2 trailing zeros
; height 0
; Winter time Barcelona: GMT+1 Summer time Barcelona: GMT+2

$w=+60
$s=+120
$v=%2%4
$p=0*d1#999

$c=+41.4798+002.3188
$x=~Sunrise %o$c,$w | Sunset %s$c,$w ~Daylength %u$c,$w | Nightlength %z$c,$w
$y=~Sunrise %o$c,$s | Sunset %s$c,$s ~Daylength %u$c,$s | Nightlength %z$c,$s

; Winter time selector
$b=%e#1980 %i0@a#0@b-1
b=10sun9

; Summer time selector
$a=%e#1980 %e0@a#0@b-1
a=03sun9

; What will be written, through selectors.
$p $a $x
$p $b $y
And the output of gcal --resource-file=./astronomical --heading-text="%3 %Y %U %4" --date-format='%>3w#K%1%Y%>02*M%>02*D%2' -cdl@t4 is shown in the following screenshot.


Click to enlarge

This is getting hard... I know, all these commands together are getting increasingly harder to write or comment. If you happen to use or call a specific command really often, you can call gcal -list-of-commands-really-long -S name and it will output that call into a executable shell script that when invoked calls Gcal with said options. This one is great!

I hope you enjoyed this small tutorial on Gcal. Please also read the one I used as a guide (which covers a few more things I ommited), and refer to Gcal's documentation if in doubt. If you liked this post, consider sharing it with your favourite tool (Stumble, reddit, digg, mail). Thanks!

Next week I'll show you how to use sed to add colours to your events, and how to set at to send you an email every day with your scheduled tasks. You can see a sample from my colour scheme below.




You may be also interested in
The "Related posts" method I use involves Javascript, thus it doesn't work in the RSS feed. To view related posts, please refer to the original article. Thanks!



08/04/2010 - Power to the command line

Are you command-line savvy?

The command line. That small place, where a lot can happen. And more so if you are a Linux user... How to maximize it? Where to harness its power?

I discovered commandlinefu.com a few years ago, while looking for a way to do... something. I don't even enter that often, although it is a brilliant place to discover how to do X in Linux/UNIX.

Among its all time greats I found some gems, and some others I discovered elsewhere, or even I made up.

Command line gems (and rocks?)

Run the last command as root: sudo !! as in
apt-get install something
-> error, you have to be root
sudo !!
The double exclamation mark recovers the last command in the history.

Use the last argument for the last command: !$ as in
mkdir /path/to/somewhere
cd !$
Change to the previous directory: cd - as in (after the previous example to get back to where you started)
cd -
Backward history incremental search: C-r in the terminal prompt, start writing the command you want to backward-search. Press C-r to keep on searching for that term.

Correct typo in previous command: ^typo^corrected as in
sudo apt-get isntall somepackage
^isnt^inst
Write command in editor: C-x C-e will fire the editor in $EDITOR to write the following command.

Open the last modified file of a type: I use this to open the most recent ppm file in a directory with Eye Of Gnome: eog "$(ls -rt *.ppm | tail -n 1)"

Use locate to search for a specific PDF and open it with evince: evince "$(locate *partofname*.pdf)" This will only work if it results in only one instance. If you want to open only the first occurrence evince "$(locate *partofname*.pdf | head -n 1)"

The same with find: evince "$(find -name 'NameOfPdf.pdf')"

Mighty heads and tails: head -n N file, tail -n N file will return the first (resp. last) N lines of file.

Get Pid of a process by name: ps ax | grep "firefox"

Follow changes on a incremental file: tail -f filename as in following nohup.out from a running process.

Get all lines containing a string in a file: grep -e "string" file > outputfile Useful as intermediate step for plotting specific data lines from a nohup.out file. With -r, change the string for a regexp (consider buying this book if you will use them more than once, I recommend it: Mastering Regular Expressions).

I think I have a few more, but I just don't remember them.

What are your special command line tricks?
Are you a command-line jedi or more like a command line young one?

You may be also interested in:



31/01/2010 - Part of iPad
I got linked to Ipad's "history": Someone on MetaFilter posted a link to my emacs on iPod blog post in the thread about the launch of Apple's iPad.You may also likeParseList(ScrambleList(Relateds(Linux,iPod,Mac,emacs)),5)

23/01/2010 - TouchTerm Pro: ssh for the iTouch
SSH on the go. This is what TouchTerm Pro promises, and perfectly delivers for your iPhone and iPod touch terminal enjoyment. I needed some way to connect to my office computer, to check program running, start processes, such things. Before jailbreaking, there was only one option, and anyway, after doing I am using it and don't mind the 7,99€ spent on it.Password blocked, then you can set your

17/01/2010 - Minix on the iPod: where Linux started
This is where Linux started. Minix, from the bible on operating systems. You can easily install it on minivMac for your iPod, download it from this link and install the disk image in your iPod as usual. Then, unpack the files inside.Fifteen minutes later...When unpacking is finished, just open the MacMinix app, and Minix will be up and running.By the way, the username for MacMinix is root, and

13/10/2009 - fluxconf: fluxbox the graphical way
A quick one: Graphical configuration for fluxbox: fluxconf. You can just apt-get it. I found out about it in tuxmachines.org, following this link. But after using it I realized I had lost 3 entries... I am not sure if it was a bug, or what (they all had parentheses in them!). Use it at your own risk!Other fluxbox&Linux related posts:Whistle control your computer (Linux&Mac)My backup script in Mac

23/09/2009 - Three dee
I don't know exactly how (well, now I remember: I was looking for a transparent background patch for xclock), but a while ago, in Göttingen I stumbled on a 3D file system browser, called XCruiser (you can get it with 'sudo apt-get install xcruise'). It has not been maintaned for a long while, and it can't even open the files you "travel", so it is pretty useless, albeit amazing. XCruiserIt made

23/09/2009 - Fluxbox backgrounds
Here are some pictures and images which look pretty good together with my Fluxbox configuration, in my Netbook. Here they are for your enjoyment. They are supposed to be small, not to drain too many system resources. I will upload later the butterfly in higher resolution. You may also be interested inTwo weeks, still loving FluxboxThree deeAcer Aspire One 8.9' + Ubuntu + FluxboxWhistle

13/08/2009 - Analytics peak
Analytics peakAfter my post "Two weeks: Still loving fluxbox" hit tuxmachines.org, it raised as one of the most viewed pages of this blog for the month, and as you can see it bumped the number of visits for a day to more than three times its usual volume. Quite good for a follow-up story... It also appeared as one of the most read (not hard that day it seems) at fsdaily.comfsdaily.com