Wednesday, December 10, 2014

Converting PDF to a series of images... and back...

Books:

1. gather all images into one directory
2. edit / crop using GIMP
3. in GIMP, export as *.mng file

4. convert to pdf:
convert -interlace none -density 300 -quality 100 infile.mng outfile.pdf

---


...or PNGs...

convert -quality 100 input.pdf output-%04d.png

for really high quality (ie for TV slides):
convert -interlace none -density 300 -quality 80 -resize 1200 infile.pdf outfile_%03d.jpg

to convert images to pdf:

convert *.png output.pdf

-- pdf may be too large; use smallpdf.com to compress:

http://smallpdf.com/compress-pdf

Three other linux-based options to compress PDFs:

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=outfile.pdf infile.pdf

- slightly higher quality, slightly larger size
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile=outfile.pdf infile.pdf

- much more precise, much slower, not much smaller...
gs -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -dCompatibilityLevel=1.3 -dPDFSETTINGS=/screen -dEmbedAllFonts=true -dSubsetFonts=true -dColorImageDownsampleType=/Bicubic -dColorImageResolution=72 -dGrayImageDownsampleType=/Bicubic -dGrayImageResolution=72 -dMonoImageDownsampleType=/Bicubic -dMonoImageResolution=72 -sOutputFile=outfile.pdf infile.pdf


Wednesday, November 19, 2014

Rotating Backgrounds in Fedora/Linux

If your Linux flavor uses Gnome, there are wallpapers available that change throughout the day.


Great.

But, what if you want your own?

There are applications that allow you do to this, but here's a script to do it simply.

First, put the pictures you want to use in a ~/Pictures/Backgrounds directory:


Create this script somewhere handy:


Then run it:
chmod +x ./build_background_xml3.sh
./build_background_xml3.sh

Done!

Wednesday, August 27, 2014

Automating Passwordless Access

Assuming you have generated rsa keys (ssh-keygen) and assuming that ssh-copy-id is NOT working for you...

Here's the command:
cat ~/.ssh/id_rsa.pub | ssh -p 22 <login>@<dest> "cat >> .ssh/authorized_keys";
Where <login> is your username and <dest> is the server to which you're sending the public key.

OR, if you do this often, create passwordless.sh:

To run it:
chmod +x passwordless.sh
./passwordless.sh <login> <dest>

Saturday, August 23, 2014

Android: 'Insufficient Storage Available'

I HATE this message. But this article has helped me to resolve it.

I'm tired of removing apps so I can install another one, when I know there's ample space for them.

Finally, I've had enough; thanks, Google, IT World, and Kevin Purdy:

There is a kind of clean-sweep method of wiping out the cache on all your apps at once. You'll have to clear enough space for it, of course, but if you can fit the 1.31 MB App Cache Cleaner on your Android, you'll free up much more space in return. It's an ad-supported product, with occasional pop-ups. But ignore whatever goofy game it wants you to install, look at the "Total" count in the upper-right corner, and then click the big green "Clean" button at the bottom. That's a bit more space, so try installing that app that wouldn't fly once more.

I'm in love with my Android again.

Tuesday, April 29, 2014

Google Hangouts Video Call - Allow both talk plugins...

Ok, I just spent 30 minutes tinkering with Google Hangouts (Fedora, Chrome) to try to get video calling working.  Every time I tried to initiate a video call, a new window would pop up with a message that read:

Select "Allow" for both Google Talk plugins in order to access the video call.

Of course, there isn't anything to click to enable the plugins.  Weird.

Eventually, I found out that by telling Chrome to automatically run all plugins, it would work.

chrome://settings/content

Scroll down to "Plug-ins" and select "Run automatically (recommended)"

Once that's done, start a video call; works fine.

Since I'm paranoid, I went back and changed the Plug-ins setting back to "Click to play" and, guess what?  Video calling still works!

(Lustre) Best practice for changing file permissions

On a Lustre filesystem, don't use chmod/chgrp/chown by themselves.

The best method incorporates the lfs find command:
lfs find <subdirectory> | xargs chgrp <new group>
chmod or chown commands with -R option (or using the normal find) are not very fast if the subdirectory contains lots of files.

Friday, October 25, 2013

Capturing RTMP video (aka Flowplayer) (in Fedora)

It may not be very elegant, but it works.

First, install rtmpdump:
sudo yum install -y rtmpdump

Then, create this script somewhere handy:
#!/bin/bash
sudo iptables -t nat -A OUTPUT -p tcp --dport 1935 -j REDIRECT
echo starting
rtmpsrv | tee rtmp.txt
echo ended
sudo iptables -t nat -D OUTPUT -p tcp --dport 1935 -j REDIRECT

Run the script, then, while it is running, try to watch the video in your browser.  If it is an RTMP stream, the terminal should show some capture information.  Ctrl+C in the terminal.

Now, you may have to edit the rtmp.txt output file to remove extra text, but leave the "rtmpdump" commandlines.

Finally, execute:
sh ./rtmp.txt

...to download the video.

(Create an alias:  alias capture='~/path/to/rtmpdump/script.sh')