Category Archives: Unix One-Liners

How to download Cygwin to install it offline

Currently the installation of Cygwin requires that we run the setup and point to the nearest mirror site and the setup program will download the packages that you choose. A lot of times I have encountered problems with the connection using the Cygwin setup program. Sometimes it won’t even connect to any server listed.

Also posted in Computer/IT, HowTo, Tech | Tagged | 3 Comments

Generate random filenames via bash

I have a bunch of jpegs that I need to sort randomly for a slideshow. In bash a random number is generated everytime the $RANDOM variable is called, so… $ for i in ../*.jpg;do cp -v “$i” “${RANDOM}.jpg” -v;done Note the “../*.jpg”, which just means I’m getting the files from a different (in this case [...]

Also posted in HowTo, Tech | Tagged , , | Leave a comment

Handy one-liners for SED

Shamelessly copied from http://www-h.eng.cam.ac.uk/help/tpl/unix/sed.html. I just want to immortalize this here because I use sed a lot. HANDY ONE-LINERS FOR SED (Unix stream editor) Mar. 23, 2001 compiled by Eric Pement <pemente@northpark.edu> version 5.1 Latest version of this file is usually at: http://www.student.northpark.edu/pemente/sed/sed1line.txt http://www.cornerstonemag.com/sed/sed1line.txt This file is also available in Portuguese at: http://www.lrv.ufsc.br/wmaker/sed_ptBR.html FILE SPACING: [...]

Posted in Unix One-Liners | Tagged , , | 1 Comment

Why you don't need HJSplit for Linux

HJSplit is famous in the DOS/Windows world as a way to split/join large files for easy network transfer. I’m just confused why they bothered to make an HJSplit version for linux. This HJSplit for Linux even requires you to install a separate library which add to the garbage for such a useless app (for nix). [...]

Posted in Unix One-Liners | Tagged , , , , | 39 Comments

Convert Nero .nrg files to .iso via dd

There’s a tool called nrg2iso to convert .nrg files to .iso files. You can use that. Just emerge/apt-get/make the tool and you’re done. nrg2iso cd-image.nrg cd-image.iso OR You can use the `dd` command. The difference between an NRG and ISO file is basically a 300kb header that Nero adds to a simple ISO file. So [...]

Posted in Unix One-Liners | Tagged , , , | 8 Comments

Converting video formats in unix

I give no explanations. You can consult your man page for that. My aim is to write quick and dirty hacks, not an entire book on the topic. We will be using 3 tools: transcode, mplayer’s mencoder and ffmpeg — all commandline tools. Anybody who has been keeping track of this journal should by now [...]

Posted in Unix One-Liners | Tagged , , , , , , , | Leave a comment

Convert pdf to jpg with GhostScript

So you just downloaded your fresh torrents of comicbooks, magazines, etc and you want to convert each page into jpg. GhostScript comes to the rescue. Let’s say you have a 100-page simpsons.pdf. All you do is: gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=jpeg -r150 -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -dMaxStripSize=8192 -sOutputFile=homer_%d.jpg simpsons.pdf And you’ll end up with a hundred homer_n.jpg [...]

Posted in Unix One-Liners | Tagged , , , | 25 Comments

Scripted watermarks on your photos via ImageMagick

Make a nice transparent logo in png/gif format like: ImageMagick’s ‘composite’ tool has a ‘-watermark’ option. Use it like: composite -watermark 30% -gravity southeast water.png image.jpg image-watermarked.jpg Let’s break that nifty one liner: “-watermark 30%” — make the logo 30% opaque (or 70% transparent depending on where you’re looking at it “-gravity southeast” — this [...]

Posted in Unix One-Liners | Tagged , , | 2 Comments

Rename digital photos to creation date

More often than not digital cameras name their photos in succession (eg: IMG001.JPG, IMG002.JPG, etc). If you use your digicam a lot and tend to dump photos in a hurry in some directory, then some of them may get clobbered by new ones if they have the same filename. Some cameras have the ability to [...]

Posted in Unix One-Liners | Tagged , , , | Leave a comment

generate passwords via gnupg

$ gpg -a –gen-random 1 16 L87S3FpsKE36XlZlPkXHLg==

Also posted in security | Tagged , , | Leave a comment