Easy one-liner using "convert" from the Imagemagick graphics suite to get decent .gif conversions of most* transparent .png's.
convert [imagename].png -channel Alpha -threshold 80% [imagename].gif
This converts the Alpha channel (the one IE6 has the most problem with) to either completely transparent or opaque based on the 80% threshold.
I say most, because it doesn't work for things like backgrounds or overlays (which are often too dark -- greys are often black, for example.) -- you can change 80% to 60% if you have backgrounds of mostly one colour, but it's not foolproof and often leaves darker marks around the exterior of the image.
Sunday, February 8, 2009
Creating Transparent .GIFs from .PNG's
Posted by
Paul
at
5:14 PM
0
comments
Labels:
graphics,
one line hacks,
zen-cart
Sunday, January 4, 2009
Ubuntu, Pulseaudio, Small Addendum.
I've tended to use this howto to tweak audio configurations whenever I install a new Ubuntu box for someone -- it makes everything from laptop speakers to Skype work much better, shockwave flash videos work (Youtube, etc) and it makes audio a much better experience all-round.
Today, a user who was having audio stuttering issues in Skype mentioned that when running it in verbose mode (with -vv), the following error occurred:
I: main.c: Called SUID root and real-time/high-priority scheduling was requested in the configuration. However, we lack the necessary priviliges:
I: main.c: We are not in group 'pulse-rt' and PolicyKit refuse to grant us priviliges. Dropping SUID again.
I: main.c: For enabling real-time scheduling please acquire the appropriate PolicyKit priviliges, or become a member of 'pulse-rt', or increase the RLIMIT_NICE/RLIMIT_RTPRIO resource limits for this user.
I: main.c: Note that real-time/high-priority scheduling is NOT normally required. If you experience crackling or other sound anomalies, consider one or more of the above solutions.
The easiest way to fix that, is to open a terminal window and run:
sudo usermod -G pulse-rt -a [username] (where of course, [username] is your desktop username.
(note: it needs to be a capital -G and a little -a to add your user to the pulse-rt group and leave your existing groups untouched, one of those check twice, then check again, then press enter moments)
If you re-run Pulseaudio now, you'll get:
I: main.c: PolicyKit refuses acquire-high-priority privilige.
I: main.c: We're in the group 'pulse-rt', allowing real-time and high-priority scheduling.
I: core-util.c: Successfully gained nice level -11.
Which tends to make Skype and WINE (the two applications the user in question was having stuttering audio issues with) behave more normally.
Posted by
Paul
at
12:36 AM
0
comments
Labels:
pulseaudio,
ubuntu
Wednesday, December 31, 2008
Something Completely Different
A completely non-technical post to end the year on -- highlighting two albums i'm almost sure nobody reading this has ever heard, but are definately worth the listen.
Lazyboy TV - Lazyboy
Angles - Dan le Sac versus Scroobius Pip

Posted by
Paul
at
1:02 PM
0
comments
Labels:
musical tastes,
opinions of the funk
Friday, December 26, 2008
Automounting SAMBA Shares
note: This article is intended for a technical audience -- you should use caution when modifying a production system -- caveat emptor.
This is more of a collaboration of other people's posts, with some additions of my own for performance-related issues.
Basically, I manage a bunch of WD MyBook Network Drive (World Edition) boxes for various people -- typically, these are hooked up via SMB shares to various types of Linux install for redundant network backups over the LAN.
After various hacks, from mounting as part of a cronjob to modifying /etc/rc.local -- I decided to attempt automatic fstab mounting under the christmas break and figured i'd document my findings here.
First off, to automatically mount the filesystems on the MyBook -- you need to add lines similar to the following to your /etc/fstab file.
//[SMB SHARE]/[sharename] /media/[mountpoint] cifs credentials=/root/.smbcredentials,rw,iocharset=utf8,uid=[username],gid=groupname,file_mode=0664,dir_mode=0775 0 0
(note: Blogger has wordwrapped this post, but this should be one line when copied to your /etc/fstab file.)
Where:
- SMB SHARE -- Is the NETBIOS name or IP address of the MyBook.
- sharename -- Is the name of the share you need to mount (personally, I like to make at least shares based on the usernames using the box).
- credentials=/root/.smbcredentials -- Is a plaintext file containing the username and password of the user you have created on the MyBook.
- iocharset=utf8 -- Specifies that all files written or read from the device should be in the UTF-8 character set.
- rw -- Specifies that access to the share should be read-write.
- uid=username,gid=groupname -- Specifies the username and groupname on the local Linux machine.
- file_mode=0664,dir_mode=0775 -- Specifies the octal permissions of the files written on the MyBook.
- 0 0 -- Means fsck will not attempt to check the filesystem under any circumstances, this is always advisable when mounting SMB shares.
After you have edited your /etc/fstab file, you need to make your credentials file -- this file specifies the name and password of the user on the MyBook.
This file needs two lines, with a trailing blank line -- and should usually be placed in the /root or /etc/samba directory and have 0600 permissions.
An example of this file is:
username=winuser
password=winpassword
Save this file and change it's permissions, then alter your /etc/fstab file to point to it's location.
Once you've done this, you should be able to have your shares automatically mounted by your Linux box (after either rebooting or running mount -a as root).
One particular quirk you might find using this method -- is unmounting errors -- these occur because the shutdown routine (by default) shuts down the network devices (specifically, those machines running NetworkManager to control network resources) before unmounting any mounted network shares (ie. what we're trying to achieve here).
These errors usually halt the shutdown of your machine (usually meaning you have to power off using the power button, which can damage your filesystem).
To fix this, you can run the following as root:
ln -s /etc/init.d/umountnfs.sh /etc/rc0.d/K15umountnfs.sh
ln -s /etc/init.d/umountnfs.sh /etc/rc6.d/K15umountnfs.sh
Which will alter your system to unmount the network-attached shares before NetworkManager has a chance to shutdown the network devices.
Posted by
Paul
at
10:01 PM
0
comments
Labels:
community service announcement,
linux,
samba
Friday, December 19, 2008
Unattended Password Creation Failing?
Earlier, I was asked if I had any good solutions for scripting a user account generator in bash -- asking the user what they had already, I received:
useradd -n -g users -p [password] -s /bin/false [username]
I asked what the problem seemed to be, and the response was the password didn't seem to work -- if they used 'passwd' interactively, it'd work -- but unattended, it failed.
Having a look at the useradd manual, we see:
-p -- The encrypted password, as returned by crypt(3).
After trying various combinations - I thought about OpenSSL. What if I gave it the password and got it to do the crypt work first, then fed the encrypted string to useradd?
Something like:
#!/bin/bash
clear="[password]"
crypt="openssl passwd -crypt $clear"
success="0"
failure="1"
useradd -n -g users -p $crypt -s /bin/false [username]
exit $?
Cut and Paste the above into a script and instantly you have a semi-autonomous way of adding generated (or defined) passwords to your machine, all with the help of OpenSSL.
Posted by
Paul
at
2:26 AM
0
comments
Labels:
linux,
openssl,
shell programming
Friday, December 12, 2008
Interesting Spin on Proposed Internet Filtering
Oh, December seems to be rant month.
Some Swinburne University students asked me for a little more clarification on why the proposed Australian Labour Government's filtering idea is a bad one.
I'll be writing my concerns up at length and back-posting them here as they are finished. However, because tomorrow is protest day, i'll post an couple of interesting links you may wish to read:
The ACMA's Report on Closed-Environment Filtering for 2008 : Basically suggests 'The Filters were better than the last time we tested them in 2005, because they filter SSL based traffic now, but they could still degrade network performance between 2 and 87 percent and still have a 23 to 40 percent chance of false-positive filtering.
Telstra Says No To Filtering - The Australian : When Australia's Largest Carrier decides they can't participate because of 'customer management issues' (possibly due to them moving a large chunk of their support staff, who'd receive the brunt of the complaints offshore earlier in the week) -- it says something about the ways this particular idea will effect everyone in the country, in one way or another.
How To Easily Bypass Australia's Internet Filters (for free) - Sydney Morning Herald : Explains to the technical neophyte how to use VPN software and other proxy methods to bypass the filter, in a worst case scenerio.
Labor’s Mandatory ISP Internet Blocking Plan - Electronic Frontiers Australia : Analysis of the ACMA proposal, discussions on why this proposal effects everything from online commerce to the civil liberties of Australian citizens and a well reasoned argument on why parents should filter their children's use, followed by a locally installed filter on the computers in the home -- If you haven't read this, you certainly should.
Posted by
Paul
at
1:37 AM
0
comments
Labels:
censorship,
the interschnitzel
Wednesday, December 10, 2008
Apple Sued Over iPhone Performance Issues
I stumbled across this article on Wired a few days ago. US-centric as it is -- but the same drop-outs seem to happen here in Australia, whenever the phone switches from 3G to the older GSM network.
Two bars on 3G on my Nokia E66 or N73 versus 4 bars on the iPhone, less than 3 inches away from each from each other when the phones are idle, yet the Nokia's complete the calls and the iPhones drop out.
Back in August, Optus (SingTel) offered 'Goodwill Credits' to users who suffered woeful network performance following the launch of the iPhone, which they're not doing now -- yet the latest firmware update doesn't seem to make a scrap of difference.
Perhaps that's why I saw a paper-printed advert in my local Optus dealership that said 'iPhones available for pre-paid plans, $799 AUD for 8GB, $899 for 16GB - while stocks last.'
Does anyone else have similar issues with providers here, or is this just another case of 'never buy G1 hardware' coupled with 'if it isn't broken, don't replace it?'
Posted by
Paul
at
11:54 PM
0
comments
Labels:
mobile telephony,
opinions of the funk,
the interschnitzel