September2008
Create a self-signed SSL certificate with a single command
This doesn’t have to be complicated at all. This was what I did on my ldap servers:
[user@ldap-primary /etc/openldap/cacerts ]$ sudo openssl req -newkey rsa:1024 -x509 -nodes -out ldap-primary.pem -keyout ldap-primary.pem -days 3650
[user@ldap-slave1 /etc/openldap/cacerts ]$ sudo openssl req -newkey rsa:1024 -x509 -nodes -out ldap-slave1.pem -keyout ldap-slave1.pem -days 3650
That’s it! No messing with the CA.pl script or running multiple openssl commands for requests, signings, password stripping, and catting keys/crts together. I tested my LDAP implementation like this and it worked like a charm. Having a copy of both certificates located at /etc/openldap/cacerts/ on both machines worked for me. When I set up clients, I put the certs in their cacerts directory and they work just fine with start tls. If you’re doing this for an openldap implementation, you can make sure it’s working using “ldapsearch -x -ZZ” which requires your encryption to work.
DIY Human Powered Electricity Generator
This doesn’t look that hard to make! Pedal powered electricity generator! Charge your cell phone, laptop, or run a small appliance or two. This would make a great alternative or supplement to an old gas generator. When you lose power in a storm you know you’re not going to make it to the gym that week or it’s at the least going to disrupt your routine anyway, so why not stay in shape at home by peddling away!
http://www.scienceshareware.com/bike-generator-using-a-car-alternator.htm
Or you can buy prebuilt generators. Mount any old bike on the stand and pedal away.
http://www.econvergence.net/cyclech.htm
I think the portable version is my favorite. Attach it to your bike and generate power while you ride to work or to the store.
http://www.econvergence.net/electro.htm
Setup your own YUM repository, the easy way!
I don’t understand why some people think this is a complicated thing to set up, so here goes my approach which I think is the easiest method. Perhaps you’re behind a very restrictive corporate firewall or you want to conserve bandwidth when you’re setting up several machines. You can set up your own repositories on one machine in your network and have it download the packages and updates in the off-hours. Whenever a client machine on your network wants updates, they’ll get them much faster and you’ll save bandwidth too.
Step-by-step:
Install createrepo on the machine you want to be your update server.
[user@hostname ~]$ sudo yum install createrepo
Now you’ll create a few crons to create and maintain your mirror. Let’s start with the one that does the grunt work of downloading the packages. I’ll go ahead and set a bandwidth limit and log my mirroring. I don’t care about debug stuff so i’ll exclude that and any iso’s that may get dumped in there too.
#!/bin/sh
# GET THE LATEST PACKAGES
/usr/bin/rsync -aq –bwlimit=500 –stats –log-file=/var/log/rsync/i386.rsync.1.log rsync://your-favorite-linux-mirror/linux/updates/9/i386.newkey/ –exclude=debug/ –exclude=*.iso /opt/yum/updates/8/i386/
/usr/bin/rsync -aq –bwlimit=500 –stats –log-file=/var/log/rsync/x86_64.rsync.1.log rsync://your-favorite-linux-mirror/linux/updates/9/x86_64.newkey/ –exclude=debug/ –exclude=*.iso /opt/yum/updates/8/x86_64/
Create a cron to update your repo as new rpms get mirrored.
#!/bin/sh
# CREATE/MAINTAIN MY LOCAL REPOSITORY
/usr/bin/createrepo –update /opt/yum/base/8/i386
/usr/bin/createrepo … Read More »
Make a multi-polaroid image out of jpeg’s with ImageMagick’s Montage
You can take several regular pictures or other image files and put them together into one image that looks like they’re all polaroids laid out on a desk using ImageMagick’s montage tool. If you have a dual monitor setup you can easily fit 8 across your screens at once without even overlapping much. Or you could lay them out half-covering each other to get a whole album on the screen at once. Don’t worry about the size of each image either because you’ll take thumbnails of each of them to make the final larger image.
[user@hostname ~]$ /usr/bin/montage -size 3200×1200 ~/Pictures/*.jpg -thumbnail 722×594 -bordercolor Lavender -background black +polaroid -background DarkGray -geometry -30-47 -tile x2 ~/Pictures/montage.gif
You could rotate the pictures in a script and run it in a crontab every hour to rotate your pictures for the next time you make the montage pic. If you’re not constantly downloading a new image (such as a satelite weather map or something), you could bump each file’s name along, saving the last one in a temporary position before rotating it back to the beginning of your stack. The simplest way to do this would be just moving the file names one by one. Think … Read More »
mrxvt – the best terminal out there
My perfect setup at work is two mrxvt’s side-by-side to handle all my terminal needs. Here’s the string I use to run ‘em just like I like ‘em. The 110×75 geometry is for two windows taking up most of the space on one screen of my 3200×1200 display, leaving the other lcd for everything else. (I use two 1600×1200′s in a nvidia bigdesktop setup)
[user@hostname ~]$ mrxvt -rv -sr -sb -g 110×75 -sl 9999
Lots of features must mean it’s bloated right? Wrong. It’s actually got a very small foot print.
I did a few tests, loading each app one by one and runnng the same commands on it and then looking in proc at it’s memory usage. It’s only slightly larger than rxvt and much better than other terminal emulators with comparable options.
gnome-terminal
roxterm
terminal
mrxvt
rxvt
xterm
VmPeak
320316
292996
247336
128516
103584
136060
VmSize
307620
292996
247336
128512
103584
136060
VmHWM
19260
22352
19232
3196
2876
5376
VmRSS
18332
22352
19232
3196
2876
5376
VmData
18560
10768
9720
1848
1616
2808
VmExe
284
120
152
280
148
336
VmLib
21800
19172
13788
4692
2756
4968
VmPTE
752
652
492
216
128
240
Mrxvt is what you get when you smash rxvt and aterm together in the LHC. I like the tabbiness with very little eyecandy. I don’t use translucency, text shadows, or a custom background, but if you want all that aterm-goodness, it’s there.
From the man page on Fedora:
The mrxvt program is a terminal emulator for X Window System. It provides DEC VT102 compat-ible terminals for programs that cannot use the … Read More »
Backing up your OS with dd
I love dd. Why mess with the clutter and bloat of backup software when all you really want is a simple image for those times when you accidentally wipe out something important or a hard drive goes plonk. dd to the rescue! It’s easy to use, very straight forward, and although there’s no pretty interface, that’s actually a major advantage! Stuck without a pretty gui or forced to connect through a serial cable? no problem!
While still up and running on your regular OS, use a simple ‘mount’ command to figure out which disks and partitions you’re using and write this down. In my example, sda1 is the boot partition and sdb2 is root. Disk ‘a’ has my windows system, and then my boot and swap for linux. Disk ‘b’ is one big partition with my root mount containing the bulk of my os (/home, /var, /usr, … etc.)
[user@hostname]# mount
/dev/sda2 on /boot type ext2 (ro,noatime)
/dev/sdb1 on / type ext3 (rw,noatime)
Find a live image or a gentoo installation disk and use it to boot your computer so you’re not using your regular storage devices. Just about any live distribution will do since you won’t need a gui or networking (keep it … Read More »
How to reset a mysql password from the command line
I just got WordPress installed and completely forgot to change the random password it started me off with to something I might have a chance of remembering. So to change it, I opened a terminal and changed the password field for the account I just created in mysql. Here’s how:
First you’ll need to get your password encrypted using openssl.
$ # openssl passwd -1 my_super_secret_password
$1$AIO1MlAJ$nTI.HbEKpuYRbtCpn.5Vu/
Copy this hash so you can paste it into your sql statement later. Now connect to mysql.
$ mysql -u root -p
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 976
Server version: 9.7.6evil Source distribution
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.
mysql>
If you know the database name you can just connect to it, if your forgot, which I did, just list them all.
mysql> show databases;
Connect to your wordpress database.
mysql> connect my_wordpress_database_name;
And change the password.
mysql> update wp_users
-> set user_pass=’$1$AIO1MlAJ$nTI.HbEKpuYRbtCpn.5Vu/’
-> where user_login=’admin’;
And that’s it; all done. Now you can get back to editing…