Filtered by Linux

Page 9

Reset

logrotating all my Zope event logs

February 6, 2008
0 comments Zope, Linux

I've installed a lot of Zope instances on my laptop since version 2.7.3 and out of curiosity and desperate need for more hard drive space I thought I'd log rotate them all with the standard Linux logrotate program.

Before doing the log rotate, the total size of all my event.log files came to about 290Mb! After running logrotate (twice of course to go from event.log.1 to event.log.2.gz) the total size become 20Mb. Not a huge significance in the world of gigabyte hard drives but at least something.

Linux tip: du --max-depth=1

September 27, 2007
28 comments Linux

There are lots of fancy programs for Linux to find out where your gigabytes are sitting and filling your hard drive, the simplest of them is du (from disk usage). The trick is to use the --max-depth=1 option so that you get a view of which folder weighs how much. Try this:


peterbe@trillian:~/tmp $ du -h --max-depth=1
900K    ./Example-Receipts
4.0K    ./Foredettinghelgen
44K     ./IssueTrackerBlogInterface
1.9M    ./IssueTrackerProduct
12K     ./fried-mugshots
2.1M    ./ies4linux-2.0.5
4.8M    ./pyexcelerator
52K     ./levenstein
4.0K    ./newitpdesign
4.7M    ./photoresizing
69M     ./databases
4.5M    ./i18nextract-sa
532M    .

Pretty nifty! That way you can quickly see which folder contains the most junk so that you can free up some hard drive space.

To sort it I don't know how to reformat it into human readable values but there's the command:


peterbe@trillian:~/tmp $ du --max-depth=1 | sort -n
4       ./Foredettinghelgen
4       ./newitpdesign
12      ./fried-mugshots
44      ./IssueTrackerBlogInterface
52      ./levenstein
900     ./Example-Receipts
1856    ./IssueTrackerProduct
2140    ./ies4linux-2.0.5
4528    ./i18nextract-sa
4796    ./photoresizing
4872    ./pyexcelerator
70392   ./databases
544608  .

Printer usability problem

August 24, 2007
1 comment Linux

Printer usability problem I booked an appointment for a computer repair today and there was a reference number and summary that I was told to print two copies of. One to go with the computer and one to keep myself as a reference. The page was one page long. So, in Firefox I clicked to print two copies. Our printer here at work is one of those that prints on both pages and that's where the problem lies. It printed the two copies one of each side. So only one piece of physical paper. Totally stupid.

I don't know what or who to blame for this. Is it my Firefox? My Dell printer? My Linux printer drivers? Surely there was a chance for someone working on this some time ago who chose not to think for a moment.

FacebookStatusUpdater

June 7, 2007
0 comments Linux

FacebookStatusUpdater This is silly but fun. I can with one command on the command line start updating my Facebook profile. It's not using the Facebook Developer API but a PHP script I copied from some other blog I can't find right now. Here's how I use it:


peterbe@trillian:~ $ FacebookStatusUpdater 
Peter is happily blogged about his latest facebook status updater
Updating Facebook...

It's an interactive prompt and starts with "Peter is " and then I write till I hit the Return and it gets uploaded and saved. See attached screenshot.

Truncated! Read the rest by clicking the link below.

Comparing REAL values in PostgreSQL

February 7, 2007
0 comments Linux

Long story short, if you need to compare floating point numbers against columns defined as REAL you need to first cast them to NUMERIC in PostgreSQL. And to compare equality between two numbers with different amount of significant figures you have to use ROUND().

Truncated! Read the rest by clicking the link below.

Flash 9 on Ubuntu Edgy Eft

January 10, 2007
4 comments Linux

My Ubuntu Linux on my work laptop works great but since I've strayed far away from the default options (own kernel, own window manager etc) some things sometimes don't work as expected. Such as Flash9. The problem I had was that there some some package in there that was broken for some reason: libswfdecmozilla.so

Here's what I did:


# cd /usr/lib/mozilla/plugins
# rm libswfdecmozilla.so
# wget http://download.macromedia.com/pub/labs/flashplayer9_\
update/FP9_plugin_beta_101806.tar.gz
# aunpack FP9_plugin_beta_101806.tar.gz
# mv flash-player-plugin-9.0.21.55/libflashplayer.so .
# chmod +x libflashplayer.so

Start firefox and enter about:plugins and this is what you should see

That worked for me. Hopefully this will help somebody. The help I got from this page which might also help people with a broken Java in Firefox but they don't say that you should delete the libswfdecmozilla.so driver.

UPDATE

There's a slightly more recent beta now. The November 2006 beta

UPDATE 2

Now there's a final release on adobe.com

Find largest directories with du -k

December 29, 2006
3 comments Linux

Here's a nifty little command I used today to find where my hard drive was being most used:


du -k /home/peterbe/Documents/ | sort -n | tail -10

I'm sure there are even fancier methods and programs but this works pretty damn well. Here's what the output can look like:


root@trillian:~ # du -k /home/peterbe/Documents/ | sort -n | tail -10
4240    /home/peterbe/Documents/Kalle
4852    /home/peterbe/Documents/ChartDirector/lib
7756    /home/peterbe/Documents/ChartDirector/doc/cdpydoc
7764    /home/peterbe/Documents/ChartDirector/doc
13044   /home/peterbe/Documents/*** FONT _ ***/- Font Applications -
14704   /home/peterbe/Documents/ChartDirector
547940  /home/peterbe/Documents/*** FONT _ ***
2171000 /home/peterbe/Documents/MacOSXSoftware/Adobe Creative Suite 2 Premium
3262580 /home/peterbe/Documents/MacOSXSoftware
5694808 /home/peterbe/Documents/

ImageMagick conversion comparison

December 9, 2006
3 comments Linux

I have an application where I need to resize huge digital camera pictures down to 800x600 pixels. To do this I used ImageMagick's convert program which I feel gives much better quality than Python PIL. To reduce the file size I make sure I use the -strip option to convert but the really interesting question was what quality option should I use?

Goal: the image should be as small (in bytes) as possible without too reduced in picture quality.

To get the optimal picture quality of course the right option is -quality 100 and to get the smallest file size I should use -quality 10. To find out what quality setting to use I converted an original image with the following command 10 times:


convert vase.jpg -strip -quality <X> -resize 800x600 vase.quality-95.jpg

where <X> is the varying value between 10 to 100.

Truncated! Read the rest by clicking the link below.

Memory dump blog recovery

November 1, 2006
4 comments Linux

My Firefox froze in one of the tabs when in another tab I had a long Fry-IT intranet blog half finished. To avoid having to rewrite the whole text again Jan showed me how to dump the RAM memory onto disk which I could then look through with standard tools. For this to work you have plenty of diskspace since the dump file is about 1Gb big:


$ sudo su -
# df -h
# cat /proc/kcore > /usr/kcore.dump
# strings /usr/kcore.dump > /usr/kcore.strings
# ls -lh | grep kcore
-rw-r--r--   1 root    root    1016M 2006-10-30 10:18 kcore.dump
-rw-r--r--   1 root    root      74M 2006-10-30 10:19 kcore.strings
# less kcore.strings | grep 'Bla bla bla'

Was this the most boring blog item I've written in a long time? Maybe, but it's good to have it noted the next time Firefox crashes.

Catching a carriage return in bash

October 23, 2006
2 comments Linux

I'm not a bash expert. Now I need some help with some bash syntax.

I copied a function called get_key which takes a 1 character length string from the stty input and assigns it to a variable. It's nifty because I can prompt something like this:


Select task:
1 - Task XYZ
2 - Task F19
3 - Task 123
q - quit

Truncated! Read the rest by clicking the link below.