Archive
Check the number of arguments in a bash script
Problem
My bash script requires a parameter. How to check its presence?
Solution
#!/bin/sh
if [ "$#" -ne 1 ]
then
echo "Usage: $0 <input_file>"
exit 1
fi
# else
# work with "$1" ...
Gmail Strikethrough Button
Books on graphs and graph algorithms
http://stackoverflow.com/questions/510758/can-you-suggest-a-good-book-on-graphs-and-graph-algorithms
Links
- Graph Theory with Applications by J.A. Bondy and U.S.R. Murty (in HTML and PDF)
- Introduction to Algorithms
- Graph Theory
- Programming Challenges
- Introductory Graph Theory
- Data Structures and Network Algorithms
RSOE EDIS
we just have to observe the connections.”
RSOE EDIS
Disasters Information Service · Emergency Communication · Budapest, Hungary
Find RSOE EDIS on Facebook too.
See the facts that your government doesn’t want you to know…
Hibernate your Ubuntu
Problem
Hibernating didn’t work on my laptop. Ubuntu said there was not enough swap space. Well, it was true, I only made a 1 GB swap partition while my laptop had 3 GB RAM.
Solution
I had an ext3 partition which was not completely full, there was 4 GB free space on it. First I made a backup of this partition to an external HDD. Then I resized this partition with gparted, cutting off 3.3 GB at the end of the partition. My laptop has 3 GB RAM so I made a swap partition that is a bit larger (just to be sure).
After that, following this SwapFaq guide, I could tell Ubuntu to use this new swap partition for hibernating.
Note that hibernating doesn’t work with swap files. You need a swap partition for that.
Swappinness
“The swappiness parameter controls the tendency of the kernel to move processes out of physical memory and onto the swap disk. swappiness=0 tells the kernel to avoid swapping processes out of physical memory for as long as possible. swappiness=100 tells the kernel to aggressively swap processes out of physical memory and move them to swap cache. The default setting in Ubuntu is swappiness=60.” (source)
Current swappinness value:
cat /proc/sys/vm/swappiness
How to change the swappinness value:
sudo vi /etc/sysctl.conf
Then change this line (or add it to the end of the file if it doesn’t exist):
vm.swappiness=10
Save file and reboot.
Hibernate from command-line
sudo pm-hibernate
I added a launcher to my Desktop with the command “gksudo pm-hibernate“.
An interactive viewer for .dot files
XDot is an interactive viewer for graphs written in Graphviz‘s dot language. See some screenshots here.
Installation:
sudo apt-get install xdot
Usage:
xdot stuff.dot
Ferenc (Franz) Liszt
The famous Hungarian pianist Ferenc (Franz) Liszt was born 200 years ago on October 22, 1811.
Here is a nice parody with Tom and Jerry: Hungarian Rhapsody No.2.
Some links:
- Liszt Ferencre emlékeztek világszerte (in Hungarian)
- Liszt, a remixek ősatyja (in Hungarian)
- Lisztográfia – Liszt top 5 (in Hungarian)
Seconds in one year
In 1 year there are about seconds.
Exact value:
365 * 24 * 60 * 60 = 31536000
Approximation:
>>> math.pi * 10**7 31415926
Difference:
120074 seconds, i.e. 33.35 hours.
From 12.04, LTS support is increased to 5 years
Starting with Ubuntu 12.04, Canonical increases the LTS support from 3 years to 5 years. That is, 12.04 will be supported until 2017!
Normal releases are still supported for 18 months.
Announcement here.
You must be logged in to post a comment.