Archive for June, 2009

Locking user accounts all containg the word ‘muppet’


2009
06.30

for i in `ls /home/|grep muppet`; do passwd -l $i; done;

It’s as simple as that. Just make sure you’re an authorized user or you sudo yourself the the right level…

But you knew that, too :)

String replacement in multiple files (bash)


2009
06.30

sed -i 's/old-bit/new-bit/g' *.ext

And hey presto, you’re done. Alternatively, to keep a copy of the old file, perl comes in with a helping hand:

perl -pie 's/old-bit/new-bit/g' inputname > outputname

So replacing a string snippet, like, say, a server IP, in a batch of files, this one liner can do what you need it to do.

But you knew that already :)

Mono in Debian (for C# projects)


2009
06.27

Richard Stallman has published an opinion on the matter of Debian including the Mono project in order to support some C# projects.

He warns that it “leads the community in a risky direction” citing Microsoft’s possible enforcement of patents as seen at http://swpat.org and http://progfree.org.

His point is the dependence on the C# for applications “means that writing them and using them is taking a gratuitous risk.” “We should discourage people from writing programs in C#,” he continues. It’s not the language, but the dependence that causes the problem.

Make it an option, don’t include it by default, simply for Tomboy (“Tomboy is a desktop note-taking application which is simple and easy to use. It lets you organise your notes intelligently by allowing you to easily link ideas together with Wiki style interconnects.”) etc.

I dare say he has a point.

The League of Programming Freedom’s website is at http://progfree.org and synch.cc, the Cape Town based open source consultancy on secure network communications is at http://synch.cc – but you knew that already :)

OpenVPN on Vista


2009
06.25

Quick step – just jotting it down as I keep forgetting:
route-method exe
route-delay 2

at the end of the ovpn file will do the trick (running as Administrator…)

But you knew that already! :)

Another old favourite is back


2009
06.22

http://www.synch.co.za is back (after a sabbatical of some time) so everything’s all happy again on the site, as well as on http://synch.co.za — in the meantime, only the URL synch.cc had been active.

It’s been a while! :)

Almost forgot about the tweet!


2009
06.16

What would a search-engine say if I didn’t add the basic link to the source of tweets (that comes back here if all goes well): http://twitter.com/svenwelzel

But you figured that out already :)

Now on Twitter, too


2009
06.16

Just really a matter of generating random rubbish on the net. Let’s see what the fuss/hype is all about :) Twitter is now using the OAuth method for new registration of applications (either desktop client or browser); some good implementations and code examples are over at http://toys.lerdorf.com/archives/50-Using-pecloauth-to-post-to-Twitter.html and http://www.jaisenmathai.com/blog/2009/03/31/how-to-quickly-integrate-with-twitters-oauth-api-using-php/ Still — really…

OK, so there are some benefits to a quick comms tool: http://www.google.com/hostednews/afp/article/ALeqM5izPPeM-vxCZ3iW6Qi0-N7E-0qe-Q (Google’s hosting  AFP!? But then again, so is Yahoo with a different take http://tech.yahoo.com/news/afp/iranvotetelecomfacebookyoutube) for example because of restrictive networks (http://blogs.wsj.com/digits/2009/06/15/web-users-in-iran-reach-overseas-for-proxies/)

I guess there’s value in this kind of communications mechanism. But that’s why we made http://smoobi.net / http://smoobi.com is, as well as http://www.mymojo.net, created back in 2003 by http://synch.cc It’s all about identifying the market gap :)

Seems there’s a link between bit.ly and twitter in short URLs… Odd…

Anyways.

Create a new certificate for Ubuntu the easy way (but you knew that already)


2009
06.14

For the self-signed certificate:

sudo a2enmod ssl

wget http://librarian.launchpad.net/7477840/apache2-ssl.tar.gz

tar -zxvf apache2-ssl.tar.gz

sudo cp apache2-ssl-certificate /usr/sbin/

sudo cp ssleay.cnf /usr/share/apache2/

sudo mkdir /etc/apache2/ssl

cd /etc/apache2/ssl

sudo apache2-ssl-certificate -days 365

sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/ssl

sudo ln -s /etc/apache2/sites-available/ssl /etc/apache2/sites-enabled/ssl

Modify the ssl site-available:

NameVirtualHost *:443

<virtualhost *:443>

ServerAdmin webmaster@localhost

SSLEngine On

# the following lines are links to the certs

SSLCertificateFile /etc/apache2/ssl/apache.pem

DocumentRoot /var/www/

Everything else stays the same.

Now all that remains is to restart your server:

sudo /etc/init.d/apache2 restart

All done!

Found this online :)

Copying files from one server directory to another (without sapping resources)


2009
06.03

cp just saps resources when transferring large volumes of data between directories. Especially on old machine memory usage spikes when the process is started and the machine becomes almost unresponsive. That’s on large volumes of data (and old hardware).

Enter rsync stage left. OK, none of this is new (you know all this already) — it’s really just to have in one spot:

No mess no fuss transfer from one server to the other (straight transfer via SSH):
rsync -av -e ssh username@oldhost:/home/old_home/ /home/new_home/

Synchronising your local to a remote directory:
rsync -r -a -v -e "ssh -l username" --delete webhost:/var/www /local/var/www

Synchronizing your remote directory to the (current) local directory:
rsync -r -a -v -e "ssh -l username" --delete /local/var/www webhost:/var/www

-r recurses, -z compresses, -v is verbose and -e is obvious

With large volumes of data (DVD isos etc) your processor is still going to be taxed (twice) — via ssh and rsync – but not quite as intensively as on the cp.

To copy files between two local directories, rsync does the job, too:
rsync -vur --delete --exclude=*.EXT1--exclude=*.EXT2 /folder1 /folder2

Quick, simple, gracious.

But you knew that already… :)