One of my work mates was trying to find the util that allows you to do “pings” to a http server. I knew about it but couldn’t remember the url thusly one has placed it on the block so i dont have to remember it httping.
apt-get install httping On running the command you get the following output
sjohnson@x:~$ httping -g http://google.com - Using proxyserver: nokes.nokia.com:8080 PING google.com:80 (http://google.com): connected to google.
After some googling i have worked out how to add keys to a luks,
First we need to generate a key dd if=/dev/urandom of=keyfile bs=1M count=10
We can then add it to luks cryptsetup luksAddKey /dev/device keyfile
Once this is done we can then unlock the device with a key cryptsetup luksOpen /dev/sdb1 external -d keyfileexternal
A device mapper will be added to /dev/mapper/external
We can then lock the device again with a cryptsetup luksClose external
How to tie into dbus to get alerts on had drive device insertion also generates pretty notifications.
Its the first set in making the code decrypt a usb device on insertion run a rdiff backup and then eject the device.
Step two is to work out how to generate a key file for a pass phrase with luks.
import pynotify import dbus import gobject from dbus.mainloop.glib import DBusGMainLoop import time class DeviceFinder ( ): def run ( self ): pynotify.
Well Nokia have announced today that we are offering free turn by turn navigation world wide. Shame google only offer turn by turn navigation in the US. More about it here.
Due to this, all the departments are now on super alert and looks like my team will be doing stupid on call shifts. All i can say its about time we started offering free navigation and free premium content.
Just had a meeting with Jan Lehnardt about Couchdb, very interesting. Talked about map reduce, how it indexes, how we could shared the data using Lounge. Looks like an exciting technology, he did a talk about couch and how it works at Peer to Peer. One of my work friends did a blog post about it.
Time to fire up the vm and start playing it seems, see if i can actually get it to perform as well as its suppose to.
After adding disks to vmware clients or new luns to san, das services its useful to get the linux os to rescan the scsci devices.
echo "- - -" > /sys/class/scsi_host/host0/scan That’s it. You can look for log messages at “dmesg” to see if it’s working. You can also look at /proc/scsi/scsi to see if the devices are there. There is also the “lsscsi” command that will show you the know devices plus the device entries that point to those devices (very usefull).
After trying to import massive db dumps and it taking for ever i came up with a script to chop up a mysql dump at the table level. This allows me to import the dumps table by table, allowing for a multi threaded import rather than a single threaded import.
#!/usr/bin/php <?php $start=time(); echo "MySQL Dump Split to Tables \r\n"; set_time_limit(600); $filetype=mime_content_type($argv[1]); if(!isset($argv[1])) { echo "Please provide dump file as a argument \r\n"; echo "If the 2nd argument is gzip it will compress the sql dumps of the tables \r\n"; exit(1); } if(isset($argv[2])) { if($argv[2] == "gzip") { $gzipoutput=true; } } if($filetype == "text/plain") { $handle = @fopen($argv[1], "r"); } else if($filetype == "application/x-gzip") { $handle = @gzopen($argv[1], "r"); } else { echo "Please provide a sql or gzip compressed sql file \r\n"; exit(1); } $header=true; if ($handle) { while (!
Just a quick post to let you know some interesting finding on the sql splitter script i wrote:
The gzip compressed size 1.2G dump.sql.gz
The decompressed size 6.4G dump.sql
Time taken in seconds splitter dump.sql gzip -- 22 ./splitter dump.sql.gz gzip -- 29 ./splitter dump.sql -- 43
The limiting factors looks to be the cpu with the gzip to gzip as php only runs on one core. Where as uncompressed to uncompressed was IO wait.
I was asked today to setup a server that will run multiple instances of tomcat, running the same application. That would sit behind a apache server that would forward the requests on the tomcat server.
An example is below:
http://localhost/tomcat1/appname -> tomcat1 :8180 http://localhost/tomcat2/appname -> tomcat2 :8280 So i added the correct items into my apache config:
ProxyPreserveHost On ProxyRequests Off <Location /tomcat1/appname/> ProxyPass http://127.0.0.1:8180 ProxyPassReverse http://127.0.0.1:8180 </Location> <Locatin /tomcat2/appname/> ProxyPass http://127.
I recently purchased a new laptop, (Hp Envy 14) that came pre-installed with windows. After leaving it on the hard drive for some time i finally needed the space. I shrank the partition as small as it could go but alas i have a SSD and every GB is expensive and needed.
I thought to myself what’s the best way to back this up, dd + nc was the way to go i thought.