Convert the colorspace of a PDF from RGB to CMYK under Ubuntu Linux
Note that converting from RGB to CMYK will usually degrade your colors because no exact mapping is possible. Anyway, this Stackoverflow post Show archive.org snapshot worked for me:
gs -dSAFER -dBATCH -dNOPAUSE -dNOCACHE -sDEVICE=pdfwrite \
-sColorConversionStrategy=CMYK -dProcessColorModel=/DeviceCMYK \
-sOutputFile=output.pdf input.pdf
Related cards:
Linux: How to print PDF files from the command line
Sometimes you may want to print files from the command line, especially when you have lots of them.
You can use lp
for that.
To print a single example.pdf
file on your default printer, simply say:
lp example.pdf
lp
accepts multipl...
Rotate a PDF under Ubuntu Linux
Use the PDF toolkit:
sudo apt-get install pdftk
To rotate page 1 by 90 degrees clockwise:
pdftk in.pdf cat 1E output out.pdf # old pdftk
pdftk in.pdf cat 1east output out....
Convert colorspace of images attached with Paperclip
has_attached_file(
:avatar,
:styles => { :large => "300x300", :small => "100x100" },
:convert_options => { all => "-colorspace RGB" }
)
AngularJS: How to hook to the end of a digest cycle (before the browser redraws)
When you run code inside a $watch
expression that forces a repaint (e.g. by computing an element's width, or running something like...
Rails: How to restore a postgres dump from the past
It sometimes happen that a database dump, that would want to insert into your development database, does not match the current schema of the database. This often happens when you have an old dump, but your current setup is up to date with the the ...
Farewell to the notification area « Canonical Design
Ubuntu is phasing out the notification area (a.k.a. “system tray”), because of its ineffectiveness at notifying people of things, and its inconsistent behavior. Many programs that previously used the notification area should use other notification...
How to get the hostname of the current machine in Rails or a Ruby script
Use Socket.gethostname
. So for a machine whose hostname is "happycat", it will look like this:
>> Socket.gethostname
=> "happycat"
That should work right away for your Rails application. For plain Ruby, you first need to do:
requi...
Linux: How to make a terminal window title reflect the current path
By default, your terminal emulator (Gnome Terminal, Terminator, etc.) sets some kind of window title to reflect the shell type you are running (e.g. /bin/bash
).
This is most often not too helpful, but you can change that from your shell.
To set...
Long cards: Directly jump from a paragraph to the same paragraph in the editor
If you hover over the text of a card, you will now see EDIT links at the top right corner of each block.
This link will open the card editor and scroll the editor to this very paragraph. The cursor caret will sit on the first character of that ...
Show the status of a running dd copy
When you do a bitwise copy using the dd
tool you will not see any output until it completes or an error occurs.
However, you can send a command signal to the process to have it show its progress so far.
From another terminal, simply call (be ro...