I haven’t had a chance to post anything here in quite a while now, partly due to lack of time, and partly due to lack of interesting or original material.
SEE VIDEO BELOW! I found myself with some spare time over the past few days and decided to try and get the robot to dance autonomously. I initially started looking at software algorithms to detect BPM (beats per minute) in music, either by using phase shifting which is challenging to write and not hugely accurate, or by analyzing amplitude peaks at a given [usually bassy] frequency, which is easier to write, and even less accurate.
Tags: amplitude, amplitude peak, CPU, ground, input, interrupt, left channel, Linux, Linux robot, phidget, right channel, Robot, sample, usb sound
Creating a layer 2 ethernet bridge under Debian (or Linux in general really) is incredibly easy, as are most things. What a L2 bridge actually is, is outside the scope of this guide, however Google has plenty of information. Essentially, ethernet frames are mirrored between the two interfaces, therefore what Layer 3 protocol data (TCP, UDP, ICMP, etc) is within the ethernet frame is irrelevant. Anyway, back to the point..
In case you don’t have the package, apt-get install bridge-utils and you’ll also need bridge support in your kernel, however unless you specifically removed it, you should have it.
(more…)
Tags: brctl, bridge, bridge-utils
I recently had my datacenter set up a new cPanel/Fantastico server for our hosting platform. Unfortunately they spelled the site name incorrectly which caused a load of problems. You can change the hostname with relative ease from within the basic setup section, however once the wrong nameservers are specified and domains are generated you’re stuck.
After fixing the nameserver addresses, you’d think that ‘/scripts/rebuildnsdzones’ or ‘/scripts/rebuildnamedconf’ would be obvious candidates however no such luck.
The answer came in the form of a 3rd party script. Back up your /var/named directory, and then download/run this perl script: http://mirrors.ndchost.com/pub/ndchost/scripts/cpanel_rebuildbindzones
Did the job perfectly for me
‘batch’ is a very useful tool for scheduling jobs to run when the server is sufficiently idle to process them.
The default is to run jobs when the server load is less than 1.5 however this can be overwritten via the atd tool with -l.
batch takes input via STDIN, i.e.:
mysqldump -u backup –all-databases |batch
‘at’ executes a command at a specific time, ‘atq’ lists the current jobs, ‘atrm’ deletes a job by ID, and ‘batch’ executes jobs when server load drops below the defined level.
The timing of batch is obviously not predictable. If predictable scheduling is required, use ‘at’ for one shots or ‘cron’ for all others. The purpose of batch is to run non time sensitive tasks when the server is sufficiently idle. Examples include mailings, bulk updates such as ‘updatedb’ or ‘apt-get update’, and log rotating or log analyzing such as awstats.
Tags: apt-get update, at, atq, atrm, batch, cron, updatedb
On the command line we have a number of powerful tools available to us. I’m going to cover some text sorting methods here.
I have a file called ‘testfile’ within this file is the following:
test:~# cat testfile
line1
line3
abcdefg
test
line9
this is a test
test file
test
(more…)
Tags: awk, cat, grep, sed, sort, text sort, uniq
shPanel is now in production. You should see http://www.adamsinfo.com/shpanel-linux-system-hosting-control-panel/ to preorder! I welcome any ideas/comments
Tags: Control Panel, hosting, Linux, shPanel, System
An MD5 is a type of Hash, also, a Checksum.
An MD5 hash is a one way verification sum which can be used to verify a string or contents of a file. Once you have a file and an MD5 checksum, the recipient of the file can also perform an MD5 calculation to ensure that the file’s contents are unchanged. They may have been changed maliciously such as in the case of a binary file, or simply by data corruption. An MD5 is NOT a type of encryption. It can not be reversed.
In the case that you know the length of the data, say between 5 and 8 characters for a password, you can attempt to brute force (try every combination automatically until something hits) the password. For that reason passwords are often salted before being MD5′d however salts and their purpose are outside the scope of this article.
We can use PHP to do the following:
<?php
$string = “teststring”;
$checksum = md5($string);
echo “The checksum is: ” . $checksum . “\n”;
?>
The output is:
The checksum is: d67c5cbf5b01c9f91932e3b8def5e5f8
We can also use the ‘md5sum’ linux command and pipe input to it via STDIN.
echo “teststring”|md5sum
test:~# echo “teststring”|md5sum
50be80a7a199c13e2bb09e2e745ba233 -
Why is the output of this md5sum different to that above? Well, ‘echo’ automatically adds a newline to the string to make it “teststring\n”. We can surpress this with -n:
test:~# echo -n “teststring”|md5sum
d67c5cbf5b01c9f91932e3b8def5e5f8 -
We can also run the md5sum command against a file:
test:~# md5sum /bin/bash
c8770eb0a3f2b6088914b4bc29301113 /bin/bash
RE my last post An idea - cPanel like host management - I’ve had some interesting comments emailed to me. I am aware of the various options out there, but I find that they don’t quite address what I’m trying to do here and are also usually either very feature lacking, buggy, and not really for production or too expensive.
I suppose what I’m trying to do here is create a management interface for system administrators like myself. I’m not sure that this is intended towards the general internet user that needs a cPanel like type interface, with big buttons and lots of help pointers and explainations. As much as I reluctantly praised cPanel in my previous post, I have a hard time handing my entire system over to the cPanel software, knowing I can’t do what I want with it anymore. On our current internal managed systems, I’ve created a primative MySQL based system whereby all domain, and mail data is stored in the database and pulled out via shell scripts on a cron job which update the relevant configs. This is far from ideal and needs rewriting.
Before this system, to add a site, I need to edit named.conf on both my primary and secondary DNS, and create a zone file which I just clone from a standard template. Then I add the domain to the mail domains database, and add users and forwards to the relevant tables as appropriate. Then I need to add an entry to apache’s config, create a web directory and set up a user account with no shell and FTP only, set permissions, then HUP apache, exim and bind.
Removing a domain involves reversing that same process. This is time consuming, and generally quite annoying.
I want a very very light management system/web interface. Powerful and feature rich but something that will not hijack my system. Something modular, clean and simple in design, and most importantly, something that works on Debian!
Recently for various reasons, specifically our acquisition of nxserve.net I have loathedly had to start working with cPanel which is what the users manage their accounts with. It’s a bit like installing some Windows based GUI on top of a Linux system. You can point and click your way around and actually get a surprising amount done, however as soon as something doesn’t workas expected, you’re absolutely stuck. Further to that, should you decide to log in to the console and make modifications as you would usually, you will either find that the entire system catastrophically fails, or that your configuration is simply overwritten by cPanel again. That said, whether or not I like it, cPanel is actually a fantastic system. How else would you successfully manage 1000+ user hosting accounts on a single server whereby you can just set up a logon and give it to the user, and he can do anything he should need? Installation is also incredibly easy. Install base CentOS and just ’sh ./latest’ which you download from cPanel. The rest is done for you.
As much as everything within me opposes something like this, I actually love it. It’s a fantastic idea and it works so well. So much so, that I’m interested to know if there is any demand or even desire for anything like this.
(more…)
Tags: cpanel, debian, host management
htop is a much heavier and feature rich version of ‘top’
Simply apt-get install htop and you’re done. You can increase or decrease the scheduling priority of running processes (see renice), you can send signals to running processes applications and view a comprehensive list of resource usage details.