Maxpedition RollyPoly dump pouch improvements

by Kevin on March 22, 2009
in Random Knowlege

Just a couple of tidbits on how to improve the aforementioned pouch.

Use paracord instead of the shock cord as a drawstring. Shouldn’t need explanation.

The next one was inspired by Peekok’s idea to have another attachment point at the bottom (if I recall it correctly).

Make a loop of paracord
paracord loop

Push loop through the drainage hole at the bottom
loop through drainage hole

Attach to a mounting point somehow (MALICE clip, carabiner, tie it whatever)

Ventrilo in Wine

by Kevin on March 19, 2009
in Random Knowlege

No, not a recepie. Ventrilo is a VoIP application of sorts that allows folk to set up private servers for friends to connect to. Mostly used for gaming but the R4nger5 use it for recording the show. I have successfully got it running through the Wine compatibility doodad.

First, run the wine config program which you can access through your menu or by running winecfg at the command line. Select the audio tab and then tick the box that says OSS. Exit that.

Once Wine is installed, it should mostly work. Have Push To Talk checked and choose what key you want. Also have both directsound boxes checked.

Reset MySQL Root Password

by Kevin on March 6, 2009
in Random Knowlege

If for some reason the root account your MySQL install is locked out, follow this procedure to reset it.

First, stop the MySQL server, this is dependant on how your system operates. For a Debian based box (Ubuntu, Knoppix et al):

sudo /etc/init.d/mysql stop

Next, start up MySQL and tell it to bypass the authentication tables (the & is to background the process):

mysqld_safe --skip-grant-tables &

Launch the MySQL client:

mysql -u root mysql

and finally change the root password:

update user set Password=PASSWORD('new-password') where user='root';
flush privileges;
exit;

Kill the running MySQL server and start it again as per usual.

Content copied from http://www.howtoforge.com/reset-forgotten-mysql-root-password

Pdflatex and bibtex

by Kevin on February 23, 2009
in Random Knowlege

Just had a small problem getting a citation to work in my dissertation. I am using pdflatex to render my dissertation into pdf format and bibtex to handle the references.

The trick is to not use the file extension of the tex file. If your file was called file.tex (yay imagination) you would do

pdflatex file
bibtex file
pdflatex file
pdflatex file

Running pdflatex multiple times is necessary to make sure everything is included in the final document.

Source (Not using Lyx so I have no idea about the top part)

Command Line Fu

by Kevin on February 16, 2009
in Random Knowlege

Finally Digg comes up with something useful. Command-Line-Fu is a site that has a ton of useful Unix (and occasionally Windows) commands.

For the adventurous (make sure you have a backup, please):

[ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo *Click*

Random images as a background in HTML

by Kevin on February 6, 2009
in Random Knowlege

A nice wee gem that Alex Peake informed me was possible. The problem: you want a randomly chosen image as a background but don’t want duplication in your css.

In your css file:

background-image: url('images/background.php');

Create the file referenced above with this code:

<?php
    $numofimages = count(glob("*.jpg"));
    $imagenum = rand(1, $numofimages);

    header("Content-Type: image/jpeg\n");
    header("Content-Transfer-Encoding: binary");

    $fp=fopen("headerimage". $imagenum .".jpg" , "r");
    fpassthru($fp);
?>

and voila, random images as a background with the bonus of being able to throw in a new image without having to do any more coding.

This code assumes that your images are called headerimageX.jpg where X is a number.

Database tidbits

by Kevin on January 17, 2009
in Random Knowlege

Restore a MySQL database from a dump file:

mysql -u root -p  databasename< file.sql

Backup a MySQL database to a file:

mysqldump -u root -p databasename > file.sql

Creating a new user and database in MySQL:

First, load up the mysql client:

mysql -u root -p

Create the database:

CREATE DATABASE databasename;

Create the user:

GRANT ALL PRIVILEGES ON databasename.* TO "databaseuser"@"hostname" IDENTIFIED BY "password";

All done, clean up and exit:

FLUSH PRIVILEGES;
EXIT;

Alpine and GPG

by Kevin on November 25, 2008
in Random Knowlege

For a while I have been trying to get used to using the command line for all of my application needs. One of the sticking points for me is email. As far as I can see, the two main text based email clients are Alpine and Mutt.

Mutt seemed to be a pain to configure, I couldn’t find an entry in the config file to put in my details and it brought in a whole bunch of other packages onto my system. Mutt seems to only be able to retrieve mail on its own. Sending requires the extra software which is a downside to me. Extra stuff to update, more possibility of security holes. Alpine on the other hand, has no such problems.

The other main part of email for me is GPG functionality. The default email client in Ubuntu, Evolution, has a really simple way of configuring GPG, just put your key ID into a text field and it does the rest. However, Evolution has a ton of bells and whistles like calendars and address book functionality. Plus I can’t have it backgrounded.

Klaatu did a Hacker Public Radio episode on how to integrate GPG and Alpine but I felt that during the main part he spoke too fast and never went over the proper syntax of the configuration lines, like the need for correct capitalisation. After hunting around a bit more, I found a page that had the correct lines ready for copy and paste (Edit: the symlinks are needed to use the filters properly).

First, open a shell and do the following commands:

sudo ln -s /usr/bin/gpg /usr/bin/encrypt

sudo ln -s /usr/bin/gpg /usr/bin/sign

Then open your .pinerc file and amend the display and sending filters to this:

display-filters=_LEADING("-----BEGIN PGP SIGNED MESSAGE")_ /usr/bin/gpg --decrypt,
_LEADING("-----BEGIN PGP MESSAGE")_ /usr/bin/gpg --decrypt

sending-filters=/usr/bin/encrypt --encrypt -r _RECIPIENTS_ -a,
/usr/bin/sign --clearsign

Whack that into your .pinerc file in the right places and so long as you have GPG set up encrypted mail should work.