You produce a PDF but it’s too big. How to reduce its size?
Make a much smaller PDF. Note that images will be quite ugly.
gs -sDEVICE=pdfwrite -dPDFSETTINGS=/screen -dCompatibilityLevel=1.4 -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf
The PDF will be a bit smaller. Images remain in good quality.
gs -sDEVICE=pdfwrite -dPDFSETTINGS=/printer -dCompatibilityLevel=1.4 -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf
For more possible values of
PDFSETTINGS, see this page.
Log in to MySQL as administrator:
mysql -u root -p
mysql> show databases;
Show tables in the database
mysql> use mysql; mysql> show tables;
Administration program for the mysqld daemon:
Another GUI administration program:
mysql-admin (note the ‘
Create a database called “finance”:
$ mysqladmin -u root -p create finance
Create a user who can work on the previously created finance database:
mysql> GRANT select, insert, update, delete, create, drop, index, alter, create temporary tables, lock tables ON finance.* TO 'myuser'@'localhost' IDENTIFIED BY 'mypass';
Now we have a user called “myuser” with the password “mypass” who can work on the “finance” database from localhost only.
Log in with the newly created user:
$ mysql -u myuser -p mysql> use finance; mysql> show tables;
You have a large file that you want to send to a friend. One possible way is to upload it to your Dropbox folder and when he got it you remove it. If the file is too big, split it into multiple smaller files. If your friend uses Windows, you should compress the file with ZIP or RAR. Here I show you how to do it with RAR.
rar a -m5 -v10m myarchive movie.avi
It will compress
movie.avi and split it into 10 MB chunks (
-v10m), using the best compression ratio (
-m5). In the case of an AVI file it won’t help much, so here you could use
-m0 too, which means no compression at all. The default is
-m3 by the way. Output:
If you prefer the traditional names (
myarchive.r01, …), add the
-vn switch too.
rar x myarchive.part1.rar
This entry is based on this post: http://linux.byexamples.com/archives/226/compress-to-multiple-volume-rar/.
“Free HTML5 Templates are just what they sound like: free web templates using valid HTML5 code. Some of the templates may also include CSS3 code as well, but those will be clearly tagged, and because CSS3 is still evolving and is highly dependent upon browser vendor implementations, the CSS may not always validate.
The goal, of course, is to help you use the newest, most modern template code available. As the HTML 5 standard evolves, we’ll evolve with it.
We license our free templates under the Creative Commons Attribution (by) 3.0, which put simply, means you can distribute, remix, tweak, and build upon our work, even commercially, as long as you credit us for the original creation.” (source)
The template portfolio is here.
Yesterday evening something strange happened to my laptop keyboard. Some keys on the right side stopped working correctly thus it became unusable.
I switched to console with CTRL+ALT+F1 but the problem remained. I rebooted the machine, it didn’t help. I booted to Windows but it was working fine there. Hmm, so the hardware is OK. But why is it not working under Ubuntu? This morning I switched it on hoping that a night rest might have solved the problem :), but no luck. I have a USB keyboard, so I could use the system with that, but what’s wrong with the original keyboard?
Then I found the problem… Num Lock was pressed by accident :))) Holy crap. I use Midnight Commander a lot and Num Lock is right next to Insert, so I must have pressed it by accident. Strangely, Num Lock remains on after switching off and on the computer.
The important thing is that my keyboard is fine and it works correctly again :)
There is a useful command in the
randomize-lines package namely “
rl“. It reads lines from the standard input and shuffles them. It can also be used to pick a random line from a text file.
Let’s see some examples from the man:
Play a random sound after 4 minutes (perfect for toast):
sleep 240 ; play `find /sounds -name ´*.au´ -print | rl --count=1`
Play the 15 most recent .mp3 files in random order.
ls -c *.mp3 | head -n 15 | rl | xargs --delimiter=´\n´ play
Roll a dice:
seq 6 | rl --count 2
Roll a dice 1000 times and see which number comes up more often:
seq 6 | rl --reselect --count 1000 | sort | uniq -c | sort -n
Shuffle the words of a sentence:
echo -n "The rain in Spain stays mainly in the plain." \ | rl --delimiter=´ ´;echo
Find all movies and play them in random order.
find . -name ´*.avi´ -print0 | rl -0 | xargs -n 1 -0 mplayer
-0 is used filenames with spaces (even newlines and other unusual characters) in them work.