Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Saturday, April 21, 2012

Force apt-get to reinstall config files

You can reinstall config files from a package with the following command:
apt-get -o DPkg::options::=--force-confmiss --reinstall install <package>

Thanks to skanx, the original post can be found at Force apt-get to reinstall config files | 6log

Monday, December 5, 2011

pdfTeX - get rid of pdf inclusion version warnings

When you include pdf-images in your LaTeX document and get this kind of warnings:
pdfTeX warning: pdflatex (file ./fig/fig_FooBar.pdf): PDF inclusion: found PDF version <1.5>, but at most version <1.4> allowed [...]
Then give pdfTeX this command:
\pdfminorversion=5
This way pdfTeX builds the document with pdf Version 1.5 instead of 1.4.
Before:
> file document.pdf
document.pdf: PDF document, version 1.4
After:
> file document.pdf
document.pdf: PDF document, version 1.5
and no more warnings.

Thanks to Mads Darø, found the solution in his blog:
Kedelig Data: Controlling PDF Minor Version in LaTeX


Just for reference:
> This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian)
Debian package version: texlive 2009-14

Thursday, September 29, 2011

External usb hdd WD Elements - avoid spindown -- #2

A little update regarding the USB HDD spin-down-problem (discussed here: External usb hdd WD Elements - avoid spindown).
I found a better workaround somewhere (sorry to the original author - i forgot where...).

By default, the APM_level is set to 96(d) (60h) after every reconnect.
When setting this value to 128(d) (80h), the drive spins down after .. approx. 30-45 minutes (i haven't tested this exactly, but it definitely doesn't spin after.. lets say 1h).

The APM_level can be set with hdparm:
# hdparm -B /dev/disk/by-label/WD_500G_NTFS
/dev/disk/by-label/WD_500G_NTFS:
APM_level = 96

# hdparm -B 128 /dev/disk/by-label/WD_500G_NTFS
/dev/disk/by-label/WD_500G_NTFS:
setting Advanced Power Management level to 0x80 (128)
APM_level = 128
Note: The hard disk doesn't remember this setting. Like written before - after every reconnect it has its default setting of 96d.


Update1 / additional information:
The hdparm method works for me on the following Kernel:
$ uname -s -r -v -o
Linux 3.0.0-1-686-pae #1 SMP Sat Aug 27 16:41:03 UTC 2011 GNU/Linux
but on
uname -s -r -v -o
Linux 3.1.0-1-686-pae #1 SMP Mon Nov 14 08:24:20 UTC 2011 GNU/Linux
i get the following error when running hdparm:
# hdparm -B /dev/disk/by-label/WD_500G_NTFS
/dev/sdb:
HDIO_DRIVE_CMD(identify) failed: Invalid argument

edit1: (17.12.2011)
-added information regarding different kernel versions.

Tuesday, September 6, 2011

Quick encryption with gpg

Today another kind of bookmark-style post;
Scenario:
You want to protect some file with a password to
  • store it on your local computer
  • send it to someone else.
You need the same password on both sides (=encryption and decryption).
(If sent to someone else, make sure to transfer the password on another way than the file.. )
  • encrypt:
    • % gpg --symetric foo.txt
      results in a file foo.txt.gpg which contains binary data
    • % gpg --symetric --armor foo.txt
      gives foo.txt.asc which contains ascii characters, which makes sense (for small files) when you want to paste it directly into an email
  • decrypt:
    • % gpg --output foo.txt --decode foo.txt.gpg
    • % gpg --output foo.txt --decode foo.txt.asc

source: http://advosys.ca/viewpoints/2006/07/pgp-symmetric-encryption/

Wednesday, August 3, 2011

Repack a .deb-archive

Today just a bookmark.
Needed to change some files inside a .deb archive; found a short tutorial here:
Repack a .deb-archive with dpkg-deb

For backup reasons a c&p from the blog above:

Thanks maff.

Sunday, May 29, 2011

External usb hdd WD Elements - avoid spindown

Update: I got a new workaound here: External usb hdd WD Elements - avoid spindown -- #2

I've got an external 2.5", 500G USB HDD from WesternDigital
- this one: http://images.google.com/images?q=WDBABV5000ABK-00.
Without being accessed, it spins down after 5-10s (seconds, not minutes!) automatically.
This behavior seems to be hardcoded in the hardware/firmware by WD and cannot be changed (if anyone knows better, please leave a comment). It can be very annoying, for example when starting a file manager or open a 'save as...'-dialog etc. because the hard drive has to spin up every time adding a delay of some seconds until the dialog appears. The same happens when reading or writing at a low speed (let's say ~ <10KiBytes/s) - the drive spins up and down multiple times a minute.

A dirty workaround is to keep the drive busy by touching and syncing in a short interval.

A quick way to do this via commandline:
while [ 1 ]; do echo "touch at - `date`"; touch /media/WD_500G_NTFS/tempfile; sleep 5s; sync; done
A bit nicer with the following script:


edit: inserted link to new post.