vrijdag 29 juli 2011

restoring couchdb database from backup .couch file

hi

at my work we're using couchdb running on ubuntu server 10.04 to log some stuff
the db was growing near the disk space, and the person responsible was absent (due to the holiday season).
so i shut down couchdb.. moved the .couch file to a diferent location and recreated the database as an empty db so the logging of data would continue.

when the person returned from holiday they needed the data, so they first took what they needed from the new db file.
After this they asked to restore the big DB file.



make sure in the new instance of couch the appropriate database has been created

shut down couchdb (/etc/init.d/couchdb stop )

restore the file to it's original location (if there is data in the new file you might want to make a backup of that first)
make sure the .couch file has the correct owner & group .. (in my case both couchdb, look at the new file to know for sure)
restart couchdb (/etc/init.d/couchdb start)


should be all done


Greetz

Wouter

vrijdag 24 juni 2011

restoring the firmware to a nslu2 from a linux PC

ok i bought a new nslu2 from ebay, and it had either a corrupt firmware, or i corrupted it trying to reset it to factory default (cause i could not figure out what ip adress it was set to, all i know is, it was not in the common ranges, and was not using dhcp)
sollution.... reflash the firmware
problem: all step by step in one document i could find online assume either windows OR Mac... i wanted to use my desktop (a debian machine) so i wrote it up.


preparation
1. get the original firmware from linksys, or an alternative firmware from where-ever. (with "might be broken" hardware i always prefer to first flash the original firmware, just to check)

2. install upslug2
apt-get install upslug2
3. set your fixed ip to something in the 192.168.0.0/24 range, but NOT 192.168.0.1 (make sure that that's free)


redboot the machine

when the nslu2 boots, for a few seconds you can telnet into it on port 9000
so boot the nslu2, and start executing the following command on your pc
telnet 192.168.0.1 9000

once you'r in you have maybe 2 seconds to press ctrl-c and interrupt the normal boot .. so be prepared

once in redboot, erase the existing bootloader ...
redboot> fis erase -f 0x50040000 -l 0x20000
and put the nslu2 in upgrade mode
redboot> upgrade
you'll see the satus led start flashing orange-green-orange-green



upslug2
run upslug2 without any switch to find your nslu2 you'll get back some info one of witch is the mac-adress (note: upslug has to be rone as root)

next use upslug2 to flash the firmware

upslug2 --target="00:00:00:00" --image="someimage.bin"

go have a coffee or thee or chocolate milk, or whatever .. it'll take 5-10 min

maandag 20 juni 2011

Opening pages documents on Debian

Hi

co-worker mailed himself a pages document from his mac .. wich he could (of course) not open on his MS Office at work
I found out that the pages document is actually a Zip format.. so
unzip document.pages

(this should also work with winzip or winrar http://www.win-rar.com/ )

it unpacked a number of files one of witch was a "preview.pdf"
note that anny images seem to be saved as seperate PDF's

if you need to edit the text you can copy paste it to your favorite editor from here ..

woensdag 1 juni 2011

encoding video for ipad with ffmpeg

Hi


I have an ipad at work , but encoding video for it using gaphicla tools is a hassle, and often turns out bad. and itunes (on my mac mini) doesn't reencode the videos... so i made a script

now my debian box can do it
(you need to install libfaac .. on my debian box i folowed the instructions here
for ubuntu users .. i know option C from this post works)

the ffmpeg command i use is
ffmpeg -i input.avi -f mp4 -vcodec libxvid -maxrate 1000 -qmin 3 -qmax 5 -bufsize 4096 -g 300 -acodec libfaac -mbd 2 -s 640x480 -ab 128 -b 400 output.mp4


still meaning everthing has to be done one by one .. still cumbersome
so i made a quick and dirty looping script

so the script becomes

#!/bin/bash

#create a folder for the encodes
mkdir $1/encodedforipad/

#encode away
for i in $(ls $1);
do

ffmpeg -i $dir/$i -f mp4 -vcodec libxvid -maxrate 1000 -qmin 3 -qmax 5 -bufsize 4096 -g 300 -acodec libfaac -mbd 2 -s 640x480 -ab 128 -b 400 $1/encodedforipad/$i.mp4
done

make it executable and call it with the first argument being the folder where you host your video files. (attention: the script is not recursive and does not handle spaces in names well).

woensdag 30 maart 2011

checking remote server with nrpe

assuming you know the comamnd you want to use on the remote server.
Usually something like:
//usr/lib/nagios/plugins/check_log-F logfile -O oldlog -q query


on the machine you want to monitor :
edit the /etc/nagios/nrpe.cfg file to include the command you want to execute (there should be a number of examples)

in my example:
command[check_login]=/usr/lib/nagios/plugins/check_log -F /var/log/messages -O /home/nagiosuser/logs/check_log.badlogins.old -q "LOGIN FAILURE"


restart the nrpe daemon:
/etc/init.d/nagios-nrpe-server restart




on the nagios server:
edit your commands.cg file to include the nrpe command

for example
define command{
command_name check_login
command_line /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c check_login

}

edit the config file for the remote host you're monitoring to add this command

in my example:
define service{
use generic-service
host_name remotehost
service_description Failed login check
check_command check_login
}

zondag 30 januari 2011

encoding video for my adroid phone (betouch e130)

hi

i've bought a acer betouch e130 a few days ago and all is well so far
have been looking how to encode video for it thou (using ubuntu)
the ffmpeg line is below ..

greetz

WOuter


ffmpeg -y -i input.avi -vcodec h263 -s 176x144 -r 15 -b 700k -acodec libfaac -ac 2 -ar 32000 -ab 64k -f 3gp output.mp4