Archive for the 'Computer' Category

download simpleviewer images

nFlickrViewer Demo  - www.chaimjaskoll.com
How to download images in a gallery where a simpleviewer is used as a flashviewer in front:

U=http://www.simpleviewergallery-somewhere-host.NETNET/gallery ; 
for a in `wget -q -O- $U/gallery.xml | egrep -o "filename>[^<]+" | cut -d\> -f2 ` ; do wget $U/images/$a ; done

If you’re new here, you may want to subscribe to my RSS feed.
Thanks for visiting!

mount WebDav in Ubuntu/Linux from FireFox

Gallery_mount_with_webDavOn a standard photo Gallery, you can select to mount Gallery on your desktop with a WebDAV client. I searched for an easy solution to mount webdav from the browser but was not able to find any scripts doing so with only one click. See the first picture to see how you find the link on a Gallery 2.0.

Here is the simple script: (Read more for an advanced script)

#!/bin/sh
 
DAVURL=`cat "$1" | grep ":url" | egrep -o "http[^< \"]+"`
DIR=`echo $DAVURL | egrep -o "[a-zA-Z0-9\.]" |xargs | sed s/\ //gi`
MOUNTPATH="/media/webdav.$DIR"
 
gksu -- mkdir $MOUNTPATH
gksu -- mount.davfs -onoaskauth $DAVURL $MOUNTPOINT
nautilus $MOUNTPOINT

Continue reading ‘mount WebDav in Ubuntu/Linux from FireFox’

Epoch to human

How often haven’t I needed to convert a Epoch timestamp (unixtime) to Human readable format?

 

 
 

From commandline:

date -d @1000000000

(replace 1000000000 with your epoch, needs newer version of date)

For more reading, see http://www.epochconverter.com/

undefined symbol: Perl_Tstack_sp_ptr

I got this error after a upgrade of perl on my ubuntu desktop station:

rolf@untuome:~/.xmltv$ tv_grab_no_gfeed --output /home/rolf/.xmltv/tv_grab_no_gfeed.xml
/usr/bin/perl: symbol lookup error: /home/rolf/.perl/lib/perl5/i486-linux-gnu-thread-multi/auto/List/Util/Util.so: undefined symbol: Perl_Tstack_sp_ptr
rolf@untuome:~/.xmltv$ mv /home/rolf/.perl/lib/perl5/i486-linux-gnu-thread-multi /tmp
rolf@untuome:~/.xmltv$ tv_grab_no_gfeed --output /home/rolf/.xmltv/tv_grab_no_gfeed.xml
downloading listings

Oneliner: Download csv of all major IP-blocks for countries:

Oneliner to download countries in .csv files. Great for building f.ex firewall (iptables?) rules with special rules for countries:

for a in `wget -q -O- http://nirsoft.net/countryip/ |egrep -o "\"..\.html" |sed -e s/^\"// -e s/\.html//` ; do wget http://nirsoft.net/countryip/$a.csv ; done

Synergy over sshtunnel

A ssh tunnel will slow down the mouse pointer which can result in a slow response on the client machine. But it will encrypt and secure the input information like your passwords typed on the keyboard. Synergy sends these unencrypted over the network.

Here is how to do it:

On the machine you are using(typing on), run synergy bound to the lo (localhost) interface. Synergys will act as a keyboard and mouse server for the machines you want to control. Do it like this:

synergys -a localhost

Remember that you need to have a /etc/synergy.conf for synergys: On the machine you using(typing on). There you need to specify that SynclientName has access to connect to you.

Then, start the ssh port-tunnel by forwarding port 24800 on localhost yourmachine connecting to it’s own localhost on port 24800:

ssh -R localhost:24800:localhost:24800 yourmachine

Start the synergy client on the machine you want to remotely control and connecting it to localhost (which is ssh-tunneled to yourmachine)

DISPLAY=:0 sudo synergyc -n SynclientName localhost

This was only a small howto on connecting two linux machines with synergy.

How to download over 6000 Free True Type fonts?

A small script to download over 6000 free TrueType Fonts from a webpage.
This script should be for learning purpose only. Removing XX makes you guilty!
Continue reading ‘How to download over 6000 Free True Type fonts?’

Send each directory over ssh to their own gzipped tar file (.tar.gz)

Find directories in the directory you are standing in:
-maxdepth 1 -type d

Exclude the first ‘.’ :
-mindepth 1

Remove the ./ part from the list:
sed s@^.\/@@gi

Tar-gzip the directory with compression 1 for faster network transfer:
tar -cv $a | gzip -1

Send the file to the dd program:
ssh -l user server "dd of=/path/to/$a.tar.gz"

Wrapping it into a small example script:

for a in `find . -mindepth 1 -maxdepth 1 -type d | sed s@^.\/@@gi`; do 
(tar cv $a | gzip -1) | ssh -l user server "dd of=/path/to/$a.tar.gz" ;
done

I suggest you install a ssh-key before doing this, or you will have to type the user password for each directory. This script does not support spaces in directory names.

The script below handle directories with space in them, just like “Document and Settings”.
I print each file (%p) with a colon at the end. The seperator used by the for-loop is also the colon which is defined by the IFS variable.

IFS=":"
for a in `find . -mindepth 1 -maxdepth 1 -type d -printf '%p:' | sed s@^\".\/@\"@gi`; do
(tar cv $a | gzip -1) | ssh -l username servername "dd of='/outputdir/$a.tar.gz'" ;
done
unset IFS

Boot the ubuntu-live cd, making the network start.
livecd$ ssh-agent
livecd$ ssh -l username server -A
server$ ssh-add

root@ubuntu:/media# dd if=/dev/sda2 | ssh -l username hostname "dd of=/path/to/save/my_backup_sda2.ntfs.disk"
The authenticity of host 'hostname (192.168.1.1)' can't be established.
RSA key fingerprint is xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'hostname,192.168.1.1' (RSA) to the list of known hosts.
username@hostname's password:
38957625+0 records in
38957625+0 records out
19946304000 bytes (20 GB) copied, 2541 s, 7,8 MB/s
37811184+2292882 records in
38957625+0 records out
19946304000 bytes (20 GB) copied, 2532.89 s, 7.9 MB/s
root@ubuntu:/media#

Scripted download of AVG definitions with BASH


Here is a oneliner of how to download avg definitions. For the full version updates, just change free.avg.com to www.avg.com on the oneliner.

wget -q -O - http://free.avg.com/download-update | grep "http://[^\"]*\.bin" -o | xargs wget

Here is a small script to download updates:

cd /path_for_updates/avg/free
for a in `wget -q -O - http://free.avg.com/download-update | grep "http://[^\"]*\.bin" -o`
do
        f=`basename $a`
        test -r $f || wget $a
done
cd /path_for_updates/avg/full
for a in `wget -q -O - http://www.avg.com/download-update | grep "http://[^\"]*\.bin" -o`
do
        f=`basename $a`
        test -r $f || wget $a
done

Here is a improved downloader for AVG:

cd /downloadpath/
for a in `(wget -q -O - "http://www.avg.com/download?prd=ibw"; wget -q -O - "http://www.avg.com/download?prd=afe"; wget -q -O - "http://free.avg.com/download?prd=afe"; wget -q -O - "http://www.avg.com/download?prd=ibw") | egrep "http://[^\"]*\.(bin|exe|sh|deb|gz|rpm|rar|iso|zip)" -o| sort | uniq`
do
        echo $a
        f=`basename $a`
        test -r $f || wget $a
done

Rebuild f-spot on Ubuntu Hardy

Got source files from
https://launchpad.net/ubuntu/+source/f-spot

Add the lines above to ubuntu sources..

echo "deb http://ppa.launchpad.net/ruben/ubuntu hardy main" | sudo tee -a /etc/apt/sources.list
echo "deb-src http://ppa.launchpad.net/ruben/ubuntu hardy main" | sudo tee -a /etc/apt/sources.list

Install missing libs:

apt-get install cli-common-dev mono-gmcs libmono-dev libmono-system-runtime2.0-cil 
apt-get install libgnome-keyring1.0-cil libusb-dev libgphoto2-2-dev 
apt-get install libglitz1-dev libglitz-glx1-dev gtk-sharp2-gapi mono-mcs
apt-get install gtk-sharp2-gapi
apt-get install libglib2.0-cil

Clean up the mess and rebuild it..

rm -rf f-spot-0.5.0.3
dpkg-source -x f-spot_0.5.0.3-0ubuntu4.dsc
cd f-spot-0.5.0.3
dpkg-buildpackage -rfakeroot -b