Tech & Toys
-
CentOS 4.x and OMSA 6.1 - Update breaks IPMI
Just recently I upgraded a Centos 4 machine which broke OMSA, this post helped me fix it.
-
Linux Setting processor affinity for a certain task or process
Just recently I wanted to be able to lock a single process to a specific CPU for testing purposes. A bit of googling lead me to thisnice explanation of how it works.
Essentially you use the taskset command to run a new proc locked to a specific CPU:
% taskset -c 1 sleep 10
Will run āsleep 10ā locked to CPU #0.
% taskset -c -p 1<br /> pid 1's current affinity list: 0,1
Shows you what PID 1 has its affinity set to.
-
Connecting HUAWEI E220 to your Mac
Every time I need to use this modem on a new mac I end up fighting with it and often giving up. Iāve made it work this time, so I intend to document the process here so I dont spend hours googling next time.
These instructions worked on my iMac and my MacBook Pro both of which were running 10.5.7.
Before you start, make sure the modem is not connected.
First off download the drivers, the ones buried in the three.co.uk support site lack a actual installer even though the documentation suggests you just need to run the installer. WTF am I supposed to do with a bunch of .kext files three? Have you heard of a nice user experience? Clearly not. Click [this link]({{ ā/uploads/2009/05/huaweidatacarddriver26-intelpkg1.zipā | prepend: site.baseurl }}) and download the zip file from here, inside is a standard OSX installer package. run that.
After that has installed, you dont need to reboot. Plug in the modem and wait a few minutes. The little LED started flashing blue occasionally for me which I think means Iāve got 3G coverage.
Once its calmed down open up network preferences where you should see a few new devices down the left hand side:
The device you are interested in is the HUAWEI Mobile, select that. Then in the āTelephone Numberā field enter *99#:
After you have done that click the āAdvancedā button. On the resulting pane, select āGenericā from the Vendor drop down. Then select āGPRS (GSM/3G)ā from the Model field. If you are in the UK, enter āthree.co.ukā into the APN field and leave the CID as 1:
Click ok, and then click Apply on the main Network Preferences pane. After youāve done this try clicking connect and you should see the following connection confirmation:
A nice little utility to monitor your connection is CheetahWatch which you can get from here.
-
Enabling vmware-tools clock sync from inside the guest
Just found out how to turn on vmware-tools clocking syncing from inside the guest, rather than editing the .vmx file on the host.
Once you have vmware-tools installed and configured try this:
/usr/sbin/vmware-guestd --cmd "vmx.set_option synctime 0 1"
To verify this has worked look for this line in the corresponding .vmx file:
tools.syncTime = "TRUE"
-
vmrun - Control VMware Fusion from the command line
Iāve just needed to snapshot a virtual machine running under VMware Fusion on my Mac but I only had SSH access. Iāve discovered the vmrun utility which is hidden away in XXX. VMware have a PDF of how to use it here. Very handy!
% <strong>export PATH=/Library/Application\ Support/VMware\ Fusion/:$PATH<br /> % vmrun listSnapshots SpaceWalk.vmx</strong><br /> Total snapshots: 1<br /> Fresh 5.2 all updates<br /> % <strong>vmrun -T fusion snapshot SpaceWalk.vmx "SpaceWalk Installed"</strong><br /> % <strong>vmrun listSnapshots SpaceWalk.vmx</strong><br /> Total snapshots: 2<br /> Fresh 5.2 all updates<br /> SpaceWalk Installed<br /> %
Bravo!
-
Scripting DynDNS
I recently needed to bulk load some entries to the DynDNS custom DNS service, I ended up using wget and a couple of bash for loops. This was the crux of it:
To login:
wget --keep-session-cookies \ --save-cookies cookies.txt \ --post-data="__login=1&username=${USERNAME}&password=${PASSWORD}" \ https://www.dyndns.com/account/
To check you are logged in:
wget --keep-session-cookies \ --load-cookies cookies.txt \ https://www.dyndns.com/account/services/zones/dns/
grep the page for āLoggedā you should see it say something like āLogged in user: blahā.
Also look towards the bottom of the page for the āmultiformā hidden form element, you need the value which is a string, something like ājaoEEPpxzAhfadQZ/dpO/A341374ā
To add an entry:
NAME=test IP=1.2.3.4 MULTIFORM="jaoEEPpxzAhfadQZ/dpO/A341374" wget --keep-session-cookies \ --load-cookies cookies.txt \ --post-data="name_new=${NAME}&ttl_new=600&type_new=A&data_new=${IP}&submit=submit&multiform=${MULTIFORM}" \ https://www.dyndns.com/account/services/zones/dns/
-
Solaris Ping
I never remember how to make Solaris ping show the time of each ping, like GNU Ping does, without any arguments the output is like:
% ping foo foo is alive %
If you want to see the time of each ping, use -s which makes it more like the GNU Ping you find on linux:
% ping -s foo PING foo: 56 data bytes 64 bytes from foo.somedomain.com (10.44.101.16): icmp_seq=0. time=0. ms 64 bytes from foo.somedomain.com (10.44.101.16): icmp_seq=1. time=0. ms ^C ----foo PING Statistics---- 2 packets transmitted, 2 packets received, 0% packet loss round-trip (ms) min/avg/max = 0/0/0 %
That is all.
-
djbdns, daemontools and ucspi-tcp RPMS
There is an update to this post, for the most recent be sure to check here.
Every so often I need a copy of one or all of these on a new machine. I tend to normally use RPM based distros and always have issues trying to find RPMS of these packages. As a result Iāve packaged them up and put them in my svn repo.
Feel free to checkout that directory, it includes a readme of how to build them for a system Iāve yet to need them on. replace the fc7 or el5 with something appropriate for your distribution.
Direct download links:
Redhat/Centos 5:
Fedora 7:
Update: This post still links to a few RPMs, but I have an updated post here, which has far more.
-
djbdns dnscache log converter
Iāve just had to struggle with the hex ip addresses which dnscache logs, after a bit of searching I found some nice notes about the log format here thanks to Rob Mayoff.
Finally I found this (Broken link
http://www.artfiles.org/qmail.org/dnscache-log.pl) handy perl script.
-
Disable Caps Lock in Windows
Nice little reg hack to dsiable the Caps lock key in windows here.