LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Blogs
User Name
Password

Notices

Just annotations of little "how to's", so I know I can find how to do something I've already done when I need to do it again, in case I don't remember anymore, which is not unlikely. Hopefully they can be useful to others, but I can't guarantee that it will work, or that it won't even make things worse.
Old

Gruesome PDF to JPG converter script

Posted 03-28-2014 at 09:57 PM by the dsc (linux-related notes)
Updated 04-10-2014 at 01:11 PM by the dsc (fixing a bug)
Tags pdf

Requires gs, imagemagick, jpegoptim, cpulimit, and "coolloop" (or maybe not).

Has no options or anything.

You run it like:

howeveryounameit.sh appropriate-filename portable-document-file-to-convert.pdf

The result will be:

appropriate-filename-001.jpg, appropriate-filename-002.jpg and so on.

So you don't add numbers or extension on the first parameter ($1). I guess it may not deal well with spaces...
Member
Posted in Uncategorized
Views 298 Comments 0 the dsc is offline
Old

Ugly script to sleep "accordingly" to CPU temperature, on loops

Posted 03-28-2014 at 09:40 PM by the dsc (linux-related notes)

Sometimes you have a script or one-liner loop thing that may put quite a heavy load on the CPU, that can be at least bothersome due to the noise of the fan, or somewhat worrisome if the temperature approaches or goes beyond what the processor specifications recommend, and yet the system doesn't do anything by itself to avoid it.

One could simply add some arbitrary, constant sleep time within the loop, but that will likely make the whole thing slower than it needs to be. If within...
Member
Posted in Uncategorized
Views 225 Comments 0 the dsc is offline
Old

Give a default/non-null value in order to avoid the "unary operator expected" error

Posted 02-19-2014 at 04:00 PM by the dsc (linux-related notes)
Tags bash

Quote:
Originally Posted by cfajohnson
Quote:
i am trying to compare a value with value 50. but i am getting
"[: -lt: unary operator expected"

I am using

if [ $j -lt 50 ]
then
echo "------------"

fi
Make sure that $j expands to a value. Best is to set it explicitly, but you can also give it a default value (0 in this example):


Code:
if [ ${j:-0} -lt 50 ]
http://www.unix.com/302295072-post3.html...
Member
Posted in Uncategorized
Views 332 Comments 0 the dsc is offline
Old

"Alpha" of an auto-renaming existing files "mv" script/function/alias

Posted 02-18-2014 at 02:02 PM by the dsc (linux-related notes)

Please don't test this on files you don't care to lose/folders you don't care to mess. I just tested once with an explicit (non-variable/"$2") destination, it seems to have worked. I don't have it as an alias or anything, it was just an "one liner" I came up with.

Code:
for on in "$1" ; do nn=$on ; num=1 ; until [ ! -f "$2/$nn" ] ; do nn="$(echo $nn | sed 's| ([0-9]*)||' | sed "s|\.| ($num).|")" ; num=$((num+1)) ; echo $nn ; done
...
Member
Posted in Uncategorized
Views 241 Comments 0 the dsc is offline
Old

"AccelMethod sna" seems to fix some issues with intel 82G33/G31

Posted 12-13-2013 at 08:26 PM by the dsc (linux-related notes)

On Debian testing/wheezy, I was having some video issues (video players, VLC and mplayer, would cease to work every now and then, and I'd need to restart X to get them to work again) with the new intel driver (2.20-something, I guess; the last one to work with no issues was 2.19, if I recall).

"Xorg -configure" wasn't generating any usable xorg.conf (exiting with error as it came up with a number of displays that "didn't match" something -- I have only one display),...
Member
Posted in Uncategorized
Views 594 Comments 0 the dsc is offline

  



All times are GMT -5. The time now is 03:29 PM.

Main Menu
Advertisement

My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration