pdftk A=even.pdf B=odd.pdf shuffle A B output collated.pdfIf the odd pages are in reverse order:
pdftk A=even.pdf B=odd.pdf shuffle A Bend-1 output collated.pdfHat tip.
Permalink | Leave a comment, tiger
Posted: 23 June 2017 @ 16:11 BST
To create a tar archive to a remote host do something like this:
tar zcvf - /wwwdata | ssh root@dumpserver.nixcraft.in "cat > /backup/wwwdata.tar.gz"
or
tar jcvf - /wwwdata | ssh root@dumpserver.nixcraft.in "cat > /backup/wwwdata.tar.bz"
Permalink | Leave a comment, tiger
Posted: 26 November 2015 @ 10:27 GMT
Use this command:
libreoffice --headless --convert-to doc *odt
The --convert-to switch uses a filter that is internal to libreoffice. There are other filters available e.g. to pdf or docx etc.
Permalink | Leave a comment, tiger
Posted: 2 August 2014 @ 08:04 BST
Use ImageMagick to convert a jpg to A4 sized PDF for printing:
convert -page A4 input.jpg output.pdf
Permalink | Leave a comment, tiger
Posted: 8 November 2013 @ 11:37 GMT
You can prepare an oversized image for the web by doing something like this:
mogrify -strip -quality 70 -resize 75% name-of-image.jpg
-strip deletes meta-data, -quality reduces the quality and -resize reduces the size of the image.
Permalink | Leave a comment, tiger
Posted: 25 May 2013 @ 17:33 BST
Recently, I had to close down Skype and try to log into it again, but Skype wouldn't let me:
"Another skype instance may exist", it kept telling me.
This is a common problem. Most of the advice on the Internet is to delete the ~/.Skype/shared.lck and ~/.Skype/USERNAME/config.lck files. This didn't work for me.
However, lsof | grep .Skype revealed that files in the Skype folder were being used. ps aux told me that they were being used by Chromium, because I had clicked on a link in a Skype chat window. It's crazy that a Chromium process spawned by Skype should lock the Skype directory but there you have it. I was able to kill the Chromium and log into Skype.
This is why lsof is an essential command.
Permalink | Leave a comment, tiger
Posted: 13 May 2013 @ 21:00 BST
Here's how to find all 'DONE' items older than 60 days in org-mode so they can be archived:
C-c a m
This brings up the agenda dialogue. Then at the 'Match:' prompt type:
CLOSED<"<-60d>"
Then, in the agenda window, to archive them all:
Permalink | Leave a comment, tiger
Posted: 23 March 2013 @ 14:56 GMT
He's how you change the browser Thunderbird will open links in:
Setting the browser that opens in Thunderbird - Linux If you are unable to launch Firefox (or another Mozilla browser) from URL links in a Thunderbird mail message, or if you want to change the browser that is launched, add the following lines to the user.js file, located in your Thunderbird profile folder (you may need to create the user.js file). Change the path of the Firefox executable, if yours is not /usr/bin/firefox. [9] [10] user_pref("network.protocol-handler.app.http", "/usr/bin/firefox"); user_pref("network.protocol-handler.app.https", "/usr/bin/firefox"); user_pref("network.protocol-handler.app.ftp", "/usr/bin/firefox"); Note: You can also use about:config to set these preferences. See Register protocol and network.protocol-handler.app.(protocol) for more information. If you are still unable to change the browser after modifying these settings, editing the mimeTypes.rdf file, also located in your Profile folder, can fix the problem. Simply use a text editor to search for all references to the browser that links are currently opening in and replace them with references to the browser that you would like links to open in. If there are no references to browsers to be replaced in the mimeTypes.rdf file, then adding some new sections to this file can fix the problem. Rather than directly editing the file, you can get Thunderbird to automatically add the required sections as follows: * Navigate to "Edit --> Preferences --> Advanced" in the Thunderbird menus and click on the "Config Editor" button. * Search for the following three entries: o network.protocol-handler.warn-external.http o network.protocol-handler.warn-external.https o network.protocol-handler.warn-external.ftp * Set the value of each of these three entries to true (you can do this by double-clicking on each entry, then close the "about:config" window and click "OK" on the "Thunderbird Preferences" window). Having completed these steps, the next time you click on an http, https or ftp link in Thunderbird, you will be presented with the "Launch Application" window. Press the "Choose" button on this window to select your browser of choice. This will add the required entry to the mimeTypes.rdf file. This is a one-time task; having selected the browser once, links of the same type will now always be opened with the selected browser.
Permalink | Leave a comment, tiger
Posted: 31 October 2012 @ 12:55 GMT
A couple of essential commands for latex headers when you are printing out a draft of your document:
\usepackage{fullpage} \usepackage{setspace} \doublespacing
Permalink | Leave a comment, tiger
Posted: 28 October 2012 @ 17:51 GMT
Very simple one-liner timer for counting down things like a Pomodoro:
sleep 25m && paplay /path/to/alarm.wav
Check the sleep manpage. paplay plays wav, raw, flac's and a few other formats, supported by libsndfile.
Permalink | Leave a comment, tiger
Posted: 14 August 2012 @ 16:18 BST
A few ideas for a timer from here:
Here's a script:
#!/bin/bash echo -n "How many minutes would you like the timer to run? " read limit echo echo "Timing $limit minutes..." echo counter=0 while [ $counter != $limit ]; do echo "$counter minutes so far..."; sleep 60 let "counter = $counter + 1" done if [ $counter = $limit ]; then echo echo "Time's up - $counter minutes have elapsed!" echo -e '\a' >&2 exit 0 fi
Here is a one-liner:
echo -e '\a' >&2; sleep NUMBER; echo -e '\a' >&2
Replace 'NUMBER' with the time as per the sleep manpage.
Permalink | Leave a comment, tiger
Posted: 14 August 2012 @ 11:46 BST
Here is a script to clean up a directory, by deleting files older than a certain date:
#!/bin/bash DIR=~/Download/ # delete files older than 7 days find $DIR -mtime +7 -exec rm '{}' \; # delete empty directories find $DIR -depth -type d -empty -exec rmdir '{}' \;
Permalink | Leave a comment, tiger
Posted: 17 April 2012 @ 12:12 BST
When installing postgresql be aware that if you have several server instances on the same machine, then postgresql will manage the ports on which each server listens by itself.
From the Debian README:
Please note that the pg_* tools automatically manage the server ports unless you specify them manually. The first cluster which is ever created (by any major version) will run on the default port 5432, and each new cluster will use the next higher free one.
Please use "pg_lsclusters" for displaying the cluster <-> port mapping, and please have a look at the pg_createcluster manpage (the --port option) for details.
The output from pg_lsclusters will look something like this:
Version Cluster Port Status Owner Data directory Log file 8.2 main 5432 down postgres /var/lib/postgresql/8.2/main /var/log/postgresql/postgresql-8.2-main.log 8.4 main 5433 online postgres /var/lib/postgresql/8.4/main /var/log/postgresql/postgresql-8.4-main.log
Permalink | Leave a comment, tiger
Posted: 9 April 2012 @ 15:33 BST
Do a screen shot from the command line with ImageMagick like this:
import MyScreenshot.png
After hitting return on this command, you draw the portion of the screen you want grabbed with the mouse.
To make a delay while you open windows or something:
sleep 10; import MyScreenshot.png
To take a shot of the entire screen with a delay of 10 seconds:
sleep 10; import -window root MyScreenshot2.png
Permalink | Leave a comment, tiger
Posted: 29 March 2012 @ 15:29 BST
Like this:
convert maphoto.jpg -resize 800x600 -strip -quality 50 -interlace line imageweb.jpg
Permalink | Leave a comment, tiger
Posted: 19 March 2012 @ 16:05 GMT
Like many people I use calibre as my ebook viewer. Yet, this program is slowly becoming a living nightmare. First is the root exploit. Second is the way that calibre wants to take over every single file. Almost all my files were defaulting to being opened in calibre. Why on Earth would I want an openoffice document opened in calibre? The creators of calibre think I do.
This obviously required fixing.
The file /usr/local/share/applications/defaults.list
looks like this:
[Default Applications] application/x-sony-bbeb=calibre-gui.desktop;calibre-lrfviewer.desktop;calibre-ebook-viewer.desktop application/x-ruby=calibre-gui.desktop;calibre-ebook-viewer.desktop text/rtf=calibre-gui.desktop;calibre-ebook-viewer.desktop application/pdf=calibre-gui.desktop;calibre-ebook-viewer.desktop application/x-cbz=calibre-gui.desktop;calibre-ebook-viewer.desktop application/x-mobipocket-ebook=calibre-gui.desktop;calibre-ebook-viewer.desktop application/x-cbr=calibre-gui.desktop;calibre-ebook-viewer.desktop text/fb2+xml=calibre-gui.desktop;calibre-ebook-viewer.desktop application/vnd.oasis.opendocument.text=calibre-gui.desktop;calibre-ebook-viewer.desktop application/epub+zip=calibre-gui.desktop;calibre-ebook-viewer.desktop text/plain=calibre-gui.desktop;calibre-ebook-viewer.desktop text/html=calibre-gui.desktop;calibre-ebook-viewer.desktop application/xhtml+xml=calibre-gui.desktop;calibre-ebook-viewer.desktop application/ereader=calibre-gui.desktop;calibre-ebook-viewer.desktop application/oebps-package+xml=calibre-gui.desktop;calibre-ebook-viewer.desktop
This is a nonsense. It has been setup to open plain text, html and pdfs in calibre. How totally stupid! It needs editing. This is better:
[Default Applications] application/x-sony-bbeb=calibre-gui.desktop;calibre-lrfviewer.desktop;calibre-ebook-viewer.desktop application/x-cbz=calibre-gui.desktop;calibre-ebook-viewer.desktop application/x-mobipocket-ebook=calibre-gui.desktop;calibre-ebook-viewer.desktop application/x-cbr=calibre-gui.desktop;calibre-ebook-viewer.desktop text/fb2+xml=calibre-gui.desktop;calibre-ebook-viewer.desktop application/epub+zip=calibre-gui.desktop;calibre-ebook-viewer.desktop application/ereader=calibre-gui.desktop;calibre-ebook-viewer.desktop application/oebps-package+xml=calibre-gui.desktop;calibre-ebook-viewer.desktop
Then run sudo update-desktop-database
. That seems to fix it.
Posted: 8 December 2011 @ 14:42 GMT
An educational institution wrote to me recently asking me to finish my degree. I ordered the prospectus and looked through the courses that passed themselves off as computer science. Very little of it was science and rest was even less about computers. In fact, I can know more and get better information by reading the right books and blogs.
It was interesting to see that others have a similar take on computer science education:
When I started college, it was as a computer science major. I thought I would use college mostly as a convenient way to learn some programming languages and strategies so I could get a degree and a job in the field. But I arrived already burnt out and ended up switching out after a semester, for two very different reasons.
The first is the state of technology today. We don’t deal with the machine; we don’t even deal with abstractions on top of the machine. We deal with layers of abstractions, layers piled so high you can’t even see where they end.
The other reason, of course, is that technology education is bullshit. I can pinpoint exactly the moment of my burnout: it was when, as a sophomore in high school, I used the conditional operator in a program for my AP Computer Science class and got marked down...
The school that asked me to complete my degree wants more students. To get them, it has dumbed its courses so that they appeal to any half-wit on the Interwebs with a pulse. The question for me is whether it's worth my time and money.
Permalink | Leave a comment, tiger
Posted: 17 October 2011 @ 14:11 BST
Recently my favourite terminal emulator got deleted from my system, because of the continuing problems I am having due to the non-functioning of KDE.
I came across this interesting discussion on the best terminal emulators. Here are the favourites:
Permalink | Leave a comment, tiger
Posted: 8 August 2011 @ 11:45 BST
ACPI administration advocacy advocacy advocacy opinion alsa amarok apache apple apt aptitude archive audio audo authentication automount avi awk backup bash BIOS boot browser business bzip cache calendar calibre cdr cdrecord censorship commandline computerscience console convert cron cut database date debian degree design desktop development disk dpkg dvd economics education emacs email europe exim faad ffmpeg file files firefox firewall flash foss freedom ftp fun fuse git gnumeric graphics grep growisofs grub gtkpod gzip hardware hardware html icedove idiocy image imagemagick images installation ip iphone ipod iptables iso itunes ivman kde kernel keyboard knoppix lame laptop latex libreoffice linux locale lockin locking longlines lsof m4a microsoft mimetypes minitab mogrify mount mp3 mp4 mplayer multimedia music mysql network nfs nfs4 nmap openbox openfiles openoffice opinion opinion orgmode partition pdf pdftk perl php podcast politics pomodoro ports postgresql print printing privacy process programming rant remote rhythmbox rss rsync rxvt scp screengrab screenshot script scripting scsi security sed server services shell siteadmin sitenews sitesoftware skype skype slackware sound sox spam spreadsheet ssh statistics subversion sudo svk swap t23 t43 tar terminal tex text thinkpad thunderbird time timer timezone ubuntu udev upgrade usb usbmount users uuid versioncontrol vfat video vnc windows wine wordpress wordprocessing X40 xwindows xwindows youtube