Akom's Tech Ruminations

Various tech outbursts - code and solutions to practical problems

Hardware Hacks Upgrading Dell laptop memory and the blinking CAPS LOCK led

Posted by Admin • Wednesday, January 18. 2012 • Category: Hardware Hacks
Apparently if you have the power-on self-tests set to "Minimal" or "Fast" or anything besides the "Let's check everything for 5 minutes every time the machine boots", you'll have a brick with a blinking CAPS lock instead of a laptop once you upgrade memory.

The only way I found to fix this (other than clearing the BIOS) was to put the old memory back in, go into BIOS, and enable thorough self-test. With that on, the laptop notices the memory size change and does not freak out - merely tells you about it. Once you're done you can disable the self-tests.

(I experienced this on a Dell Precision M4400, but googling seems to indicate that this affects the Inspiron and Latitude lines as well, probably others).

Asterisk Getting Meetme to work in Asterisk 1.6 on Ubuntu Lucid

Posted by Admin • Tuesday, November 15. 2011 • Category: Asterisk
I'm assuming that you are attempting to use the Meetme() application and getting an error like this:
WARNING[10695]: app_meetme.c:1097 build_conf: Unable to open pseudo device
It's rather simple:
$ apt-get install dahdi dahdi-dkms dahdi-linux  #I think dahdi may be enough
$ echo dahdi_dummy >> /etc/modules
$ modprobe dadhi_dummy
$ ls -l /dev/dahdi/pseudo
crw-rw---- 1 root dialout 196, 255 2011-11-15 11:26 /dev/dahdi/pseudo
$ id asterisk
(Should include 'dialout' group)

Yay! Apparently in Asterisk 1.6 the timing source for the Meetme application is no longer ztdummy (fortunately I was unable to use m-a to compile zaptel) but rather relies on DAHDI, not only for timing but for conference mixing - see http://www.russellbryant.net/blog/2008/06/16/asterisk-16-now-with-a-new-timing-api/

Asterisk CDR records 's' for DST when Dialing from Macros

Posted by Admin • Friday, July 22. 2011
At some point in the Asterisk 1.6 evolution the CDR records stopped being useful in my setup for outgoing calls - instead of a nice number (eg 18005551212) in the dst field of the record, I now have an s. I log my CDR to MySQL and I do use a macro (with AEL) to dialout. My macro is even called dialout.

According to this bug, this is a known issue and no immediate fix is expected. Not wanting to rewrite the CDR UI to use yet another column, I figured that I can fix this with a MySQL trigger, so here is one possible workaround.

Continue reading "Asterisk CDR records 's' for DST when Dialing from Macros"

Linux Figuring out the card number of a cheap SAA7130 capture card

Posted by Admin • Sunday, June 19. 2011 • Category: Linux
So you bought yourself a cheap Philips SAA7130 (or SAA713X or SAA7134) capture card to record motion, you plugged it in and you are getting a black or grey screen. Looking in dmesg you see the famous saa7134[0]: Huh, no eeprom present (err=-5)? And
saa7134: Congratulations! Your TV card vendor saved a few saa7134: cents for a eeprom, thus your pci board has no saa7134: subsystem ID and I can't identify it automatically saa7134: I feel better now. Ok, here are the good news: saa7134: You can use the card= insmod option to specify saa7134: which board do you have. The list:
What do you do? How do you try 175 card numbers and figure out which one works? Write a script!

Continue reading "Figuring out the card number of a cheap SAA7130 capture card"

Code and Hacks Migrating one Gmail account to another

Posted by Admin • Friday, May 13. 2011 • Category: Code and Hacks
I have a setup where a Google Apps Premier account is used for the active employees, but when they quit I want to archive all their mail but free up a paid user account for the next employee. We archive mail in a different domain, also on google apps - a standard edition, free. For a while now I've gone through a variety of ways of copying the mailboxes from one place to the other, and each approach was either partial, unreliable, or too time-consuming.

So I think I've finally settled on a viable approach that is neither.

Continue reading "Migrating one Gmail account to another"

Hardware Hacks Setting the date/time on the Mini Keychain Spy Camcorder

Posted by Admin • Monday, April 25. 2011 • Category: Hardware Hacks
Keychain Camcorder
The instructions that come with this little gadget are priceless in their verbatim Chinese glory, but are not helpful in their vague "Leave the details as an exercise for the reader" approach.

Here are the exact detailed steps to actually set the clock

Continue reading "Setting the date/time on the Mini Keychain Spy Camcorder"

Linux Backing up cPanel without hitting logout

Posted by Admin • Thursday, April 21. 2011 • Category: Linux
cPanel based hosting presents some challenges for automatic backups - there isn't an automatic way of creating local backups or any standard way of triggering their creation remotely. Numerous scripts exist yet none were quite the solution I was looking for - I am primarily interested in the databases and mail forwarders, though files wouldn't hurt either. Moreover - you can do this in a single line!

My Goal therefore is: Create and retrieve backups nightly. I don't want cPanel to push files to my off-site box, I'd rather initiate everything remotely and not have to open up access to some other system. cPanel does permit one to do this using a browser, hence it can be scripted. Really, scripting isn't even necessary - wget is all that is required! That said, I had a very hard time convincing wget not to visit the logout link on each page - once you log out, you're not getting anywhere anymore. So here is how I did it.

Continue reading "Backing up cPanel without hitting logout"

Linux MySQL replication dies with fatal error 1236: Client requested master to start replication from impossible position

Posted by Admin • Friday, February 4. 2011 • Category: Linux
This time, my master-master setup stopped replicating with no explanation at all - running START SLAVE yielded no warnings or errors. Inspecting the log yielded the aforementioned error (on Ubuntu, mysql logs to /var/log/syslog by default):
[ERROR] Error reading packet from server: Client requested master to start replication from impossible position ( server_errno=1236) [ERROR] Got fatal error 1236: 'Client requested master to start replication from impossible position' from master when reading data from binary log [4654]: 110204 10:09:20 [Note] Slave I/O thread exiting, read up to log 'mysqld-bin.000742', position 4274

So at first I thought this was a weird bug or a stunnel issue, but looking at 'mysqld-bin.000742' on the master it turns out that it's only 3980 bytes - position 4274 is indeed impossible. But how did it get this way?

Continue reading "MySQL replication dies with fatal error 1236: Client requested master to start replication from impossible position"

Code and Hacks The Eclipse, PDT and Smarty dance

Posted by Admin • Monday, January 24. 2011 • Category: Code and Hacks
Eclipse is a great developer tool, and I use mine for Java, PHP, and C++. It actually does all of the above really well, but when it comes to Smarty template Syntax Highlighting, it's a tale of much suffering. I honestly am not even asking for any Smarty auto-completion - just pretty colors that tell me when I'm fat-fingering the syntax.

Fortunately there is a solution that appears to work, and here is the currently valid step-by-step

Continue reading "The Eclipse, PDT and Smarty dance"

Linux Simple flat file site search in PHP/Smarty

Posted by Admin • Wednesday, January 19. 2011 • Category: Linux
Sometimes using a real search implementation (Lucene, Sphinx) is just too much. The particular site I was working on is something like 30 pages, it's maintained as flat files (Smarty templates, but it's basically HTML on disk), and it really, really should not require megabytes of code and cron jobs to be able to search it!

That said, this is a simple search solution - it makes a lot of assumptions:

Continue reading "Simple flat file site search in PHP/Smarty"

Linux Predictable ALSA numbering of USB sound cards

Posted by Admin • Wednesday, January 12. 2011 • Category: Linux
I have 3 rather cute Monoprice usb sound cards for use by mmpd (client I wrote for multiple mpd instances). The great thing about them is that for $9 you can just keep adding zones to your music systems. The bad news is, UDEV will reorder sound cards on boot as it pleases.

Zones changing would be survivable in itself (reboots are rare), but I also have a webcam and an onboard sound card that I don't use - so sometimes the numbers I've configured mpd to use aren't even valid sound cards! On to the continuing search for a working solution

Continue reading "Predictable ALSA numbering of USB sound cards"

Linux Fixing digitemp with LinkUSB on kernels after 2.6.32-24

Posted by Admin • Tuesday, January 11. 2011 • Category: Linux
As many people have discovered, kernels after 2.6.32-24 changed the USB-RS232 serial driver to not set hardware flow control (RTS/DTS) flags. No doubt there was a good reason. Unfortunately, digitemp and owfs don't enable it either, also probably for a good reason - at least when applied to older devices. What this means is that now when you try to use a LinkUSB (and probably other DS9097U type hardware behind USB to Serial converters), digitemp and owfs no longer work.

Let's apply a time-tested hackish approach.

Continue reading "Fixing digitemp with LinkUSB on kernels after 2.6.32-24"

Linux How to take down your pfSense firewall with one checkbox

Posted by Admin • Saturday, January 1. 2011 • Category: Linux
Simple: create a Traffic Shaper queue but forget to choose a queue parent.

Your firewall will not pass any packets across, and you'll have no idea what hit you.

Automotive Troubleshooting car heat issues or why stop-leak is a bad idea

Posted by Admin • Saturday, October 30. 2010 • Category: Automotive
I got my truck exactly a year ago. It came complete with stop-leak (the red brick-colored pellets) in the system. I immediately flushed out all coolant and stop-leak (must have run 100 gallons through the system with a back-flush kit), but I guess that wasn't enough, as I suddenly found myself without any heat whatsoever. Now I am not that into heat, but the idea of a sheet of ice on the windshield with no recourse just doesn't sound like fun.

Since I had to figure out what the issue was step-by-step, I figured I'd write the process down for posterity (read: me, next time). So here it is...

Continue reading "Troubleshooting car heat issues or why stop-leak is a bad idea"

Asterisk Asterisk and obfuscated SIP port redirection - calls drop after 20 seconds

Posted by Admin • Tuesday, October 5. 2010 • Category: Asterisk
One of my asterisk setups got attacked recently by a brute force script kiddie. The attack is simple:
  1. Try sequential sip usernames from 1 to 10000, hoping that the admin chose a numeric username scheme
  2. If asterisk returns anything but a 401, then perhaps this is a real account, add it to the list
  3. If anything is on the list of "possibles", then brute force their passwords


Why this works:
  • Asterisk has no delay for failed logins, so a brute force attack is viable, hundreds of attempts per second are possible. Not sure what can be done about this
  • The admin didn't set alwaysauthreject = yes in sip.conf. It's off by default, why??? With this enabled, there is no way to tell if a username is valid from the reject response


To deal with this:

Continue reading "Asterisk and obfuscated SIP port redirection - calls drop after 20 seconds"