I recently replaced a failing cable modem — the new one is an Ambit U10C109 Cable Modem. Plenty of configuration options provided you login with the admin:cableroot default username password, not the user:user one reported on the login page.
By default, remote configuration via HTTP and telnet servers is enabled. Since I couldn’t find a web-based method to disable this (you can change the ports from the defaults, but that seems to be it), instead I logged into the telnet server and disabled it from there. Here’s a transcript of the process (if you’ve changed the default port 64623, substitute your value in the telnet command below).
(Input in green, output in black, status fields of interest enhanced in italic)
$ telnet 192.168.0.1 64623
Trying 192.168.0.1...
Connected to 192.168.0.1 (192.168.0.1).
Escape charecter is '^]'.
Ambit U10C019 CableModem
From time to time you may need to know at runtime how many processors (or more accurately processor cores) are available to your program. For example, you might want to determine how many threads to use with multi-threaded FFTW.
Darel Finley succinctly shows how to do this programmatically on Mac OS X. The same code unchanged compiles on FreeBSD, and I’ve added code for Linux, and wrapped it in CPP conditionals to detect which code to use at compile time. If compiled on something other than Mac OS X, FreeBSD or Linux, the value returned defaults to 1. So without further ado, here’s nproc.c: /* Compile with: gcc -o nproc nproc.c */
#include <stdio.h>
#include <sys/param.h>
#include <sys/sysctl.h>
int CPUCount()
{
int count;
#if defined(__APPLE__) || defined(__FreeBSD__)
size_t size = sizeof(int);
if (sysctlbyname("hw.ncpu",&count,&size,NULL,0)!=0)
return(1);
else
return(count);
#elif defined(__linux__)
char *fname = "/proc/cpuinfo";
char input[256];
FILE *ptr;
if ((ptr = fopen(fname, "r")) == NULL) return(1);
count = 0;
while (fgets(input, 256, ptr))
if (strncmp("processor", input, 9) == 0)
count++;
fclose(ptr);
return((count>0)?count:1);
#else
return(1);
#endif
}
int main(void)
{
printf("CPU Count: %d\n", CPUCount());
return(0);
}
Here’s a small bash script wrapper for vpnc, the open-source VPN client for Cisco’s vpn concentrator. Put it in your path, and make sure you have an entry for you in your /etc/sudoers file (see comments in the script file for more info), and then connect, query status, or disconnect with:
vpn on
vpn status
vpn off
As noted in the script it might be just as easy to “vpnc” or “vpnc-disconnect” but this has the added bonus of reporting elapsed connection time.
Ok, short and sweet, this one. On newer flavors of 64-bit Linux (Cent OS 5.2 x86_64 in my case) you may notice Word 2000 (via Crossover Office) fails to start, instead putting out lots of lines like this one:
It should be noted that if /etc/sysctl.conf already has a setting for vm.mmap_min_addr, it should be changed, instead of adding a second definition of it as I did here.
At this point (x86_64 only I believe), you may see Word launching, but crashing without any apparent errors after a few seconds. Here, the fix is to modify how system prelinking is performed, first by undoing all prelinking, and then by modifying the prelinker settings to override Exec-Shield support (see the prelink man page for details):
# /usr/sbin/prelink -ua
# cd /etc/sysconfig
# mv prelink prelink~
# sed 's/-mR/"-mR --no-exec-shield"/' prelink~ > prelink
Some time back I was asked to set up a way to archive images from a PC (running WinXP Pro). An attached high-quality scanner was used to collect images each day. I use rsync for all sorts of situations where data needs to be copied or moved about, and here then was another opportunity to use it. Two requirements:
open-source, or at least freeware
automated, please!
On the PC I installed DeltaCopy, a free open source package built around rsync 2.6.6. It’s easy to install, easy to setup and then you forget about it. Since we wanted to save all images in E:Scans I set up the configuration on the scanner machine very simply:
[Scans]
/cygdrive/e/Scans
I also enabled a password with the username “archive”. You can find out how to do all this in the documentation that comes with DeltaCopy, it’s very clear.
The scanner machine had a firewall enabled, so I opened port 873/TCP to allow an rsync client to connect. Then on the Linux system which was going to perform the archiving, I set up a cron job to run nightly which ran the following command:
This pulled any new files from the E:Scans folder each night. Of course having the plain-text password visible, even if only by root, isn’t ideal so using SSH keys instead would be preferable.
In archive :: stuff :: Part II we will look at building on this basic archive scheme, and provide details on upgrading rsync used by DeltaCopy to 2.6.9 for a handy extra feature.
I’ve commented on the fact that I’m not a big fan of code tutorials. Following a recipe for how to get the computron to display the words “Hello, World” isn’t that educational, or interesting. Computer graphics is a whole different story *.
I’m not an artist, but I am fascinated with what artists can do with computers. I saw this tutorial today on creating text from grass, and it’s a perfect example. Well worth a look to artists and wannabes alike!
* Maybe if I was an artist and not a code writer, things might be reversed.
First I heard it with KT Tunstall’s live performance on NBC. As good as that was, I’m now a true believer after watching this jaw dropping piece from David Ford:
Makes me want to dust off my own guitar. Nah, probably never happen.
Already out of date. I found a much better way to achieve the same goal, and wrote an application to do it.
See, I’m not a fan of online programming tutorials. You know the kind, how to write “Hello World” in the new AmazingWidgetLanguage. For many they may be just the thing, but for me, learning or improving my knowledge of a programming language goes much better if I set the bar a little higher than “Hello World“. So I used SyncScrubber to learn how to write a full-blown AppleScript application in Xcode, complete with multiple script files, global variables, all that good stuff. Overkill? Perhaps. But then I accomplished what I wanted to do.
Have you seen the Asus Eee PC? No, not just “heard about”, have you actually seen it? It’s a small, elegant, inexpensive, basically a very good value Linux mini laptop. It cost €299 here in “De Peoples Republic, like“.
Joining a wireless network, even WPA2, is a breeze. It’s not the fastest kid on the block but it’s light, efficient, and dammit, it’s cool! The dumbed-down GUI, dubbed “Easy Mode” can (and IMHO should be) quickly replaced with “Advanced Mode”, or good ol’ KDE as it’s more widely known.
For more fun and amusement, and a little bit of nostalgia, install DosBox on it, and then install Windows 3.1 on top of that. How’s that for a blast from the past? (or perhaps simply an abomination, if you prefer).