Saturday, April 06, 2013

OwnCould error - CSync failed to create a lock file

locate file "lock"

> sudo updatedb
> locate -i owncloud | grep -i lock

delete file called "lock"

Saturday, January 19, 2013

Use Python 2.7 with Hostgator.com

In .htaccess of root directory:

AddType text/html py
AddHandler cgi-script .py

In the same .htaccess file, this Apache script hides ".py" extensions:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.py -f
RewriteRule ^(.*)$ $1.py

For your script example.com/filename.py, you can type example.com/filename or example.com/filename.py

Python path:
#!/usr/bin/python
print "Content-type: text/html\n\n";
print "";
print "CGI Test";
print "
";
print "Test page using Python
";
print "
";


Wednesday, January 16, 2013

compress pdf file under Linux

tested and works!

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf

Encfs everytime I start my computer


Encryption for Dropbox / Linux :

encfs ~/Dropbox ~/Work

Monday, January 14, 2013

Google cache link

here it is:

http://webcache.googleusercontent.com/search?q=cache:www.example.com


Saturday, January 05, 2013

Tumblr API with Python is a disaster, let's try with Ruby

Now, I give up on using a wrapper and will be happy to use a command line program to post stuff on Tumblr.

https://github.com/mwunsch/tumblr

Now, unlike Python, this package is easy to install:

sudo apt-get install rubygems
gem install tumblr-rb

that's it.
Wow, Ruby is so great! Wait, too bad it doesn't work either:

tumblr authorize
It's stuck.

Nevermind, it can't be a Python or Ruby problem, Tumblr API sucks big time,

Best simple pain-free solution: use email interface that Tumblr gives you in your dashboard and send mail with a python script: much, much simpler. It doesnt work with youtube embedded videos though.

Python wrapper for Tumblr API

http://code.google.com/p/python-tumblr/

Ubuntu:

install easy_install:
sudo apt-get install python-setuptools

install simple json:

sudo easy_install simplejson

install python-tumblr
sudo easy_install http://python-tumblr.googlecode.com/files/python-tumblr-0.1.zip

and then... it doesnt work!

Gotta use Tumblr's super complicated v2 API, yay for progress..

Enters Tumblpy:

sudo easy_install pip
sudo easy_install oauth
sudo pip install python-tumblpy

doesnt work


>>> import tumblpy
Traceback (most recent call last):
  File "", line 1, in
  File "/usr/local/lib/python2.7/dist-packages/tumblpy.py", line 7, in
    from requests.auth import OAuth1
ImportError: cannot import name OAuth1



uninstall packages installed with easy_install? near impossible.
http://stackoverflow.com/questions/1231688/how-do-i-remove-packages-installed-with-pythons-easy-install

sudo pip install oauth2
still doesnt work

sudo pip install requests.auth
still doesnt work


who said python was simple? :-/

Sunday, April 15, 2012

Just got first payment from anonymousads

Today I received in my bitcoin client 0.01004761 Bitcoins = 0.05 USD

The ad has been up for about a month.

Let's multiply by 12, shall we?

Revenue for a year = 0.6 USD
I need to post more.

Sunday, April 01, 2012

DuckDuckGo a search engine like Google in 2000

If you are sick of google owning the Internet, here is a pretty cool alternative search engine: DuckDuckGo

According to its wikipedia article:

DuckDuckGo uses information from crowd-sourced sites (such as Wikipedia) to augment traditional results and improve relevance. The search engine policy emphasizes privacy and does not record user information. The company is based in Valley Forge, Pennsylvania.

Some of the code of DuckDuckGo is free software distributed at GitHub under Perl 5 license.

I thought I would do my part and give them a free plug.
So use DuckDuckGo.com !!

Saturday, March 10, 2012

Just added bitcoin ads!

As you can see in the header and the footer of the blog, I just added ads from AnonymousAds. It is more for supporting the bitcoin economy more than anything else as I will probably make less than 1BTC a year from these ads!

Anyway, we should all use bitcoin (or its successors) !

Wednesday, November 09, 2011

HTML to Jpg for Linux / Mac

Very easy with http://cutycapt.sourceforge.net/

 Usage: CutyCapt --url=http://www.example.org/ --out=localfile.png

Very easy to archive webpages to jpg or png format

Friday, August 26, 2011

Sunday, October 04, 2009

guess what I am on twitter

Follow me on twitter, my efriends !

http://twitter.com/usenetbinaries

Also if you're reading this through a RS reader, you might want to add this feed :

http://altbin.net/feed

Sunday, September 20, 2009

change language gimp Linux THIS ONE WORKS

Okay, so because in the manual there's one command missing, so in every link from the first page of results in Google it's missing as well, so here's the way to start the gimp with another language, type in the command line :

env LANG=en gimp


This time it really works.

Saturday, August 15, 2009

Tuesday, August 11, 2009

Launching a forum about usenet binaries, linux etc

Hey guys, ( and girls.. oh well, probably not )

I'm "working" on a forum to host the Usenet Binaries with Linux FAQ, so that people can post question and stuff, make it a little more interactive you know. I think it deserves its own page and forum.

It's been a while since I updated the FAQ so the new stuff will be added on the forum.

The address is altbin.net

Feel free to join and post about whatever subject you might find relevant. Or if you wanna add comments about the FAQ, now would be a perfect time.

Monday, September 15, 2008

mass-repair avi videos with broken index

so yeah, my camera makes broken avi videos and I had a bunch of them to repair :


for i in *.avi; do mencoder -idx $i -ovc copy -oac copy -o $i.repaired.avi; done

( that's a command-line for those who wonder )


this only repairs the index, no re-encoding

divfixpp repairs indexes as well, but I didn't try it

hope it helps

Saturday, April 19, 2008

WiFi Laptop Asus Z53Sseries = 100% Linux compatible

nvidia graphic card : easy ( In Ubuntu : System Settings, Advanced, Restricted Drivers, etc )


Intel Wifi IW 4965:

The drivers work on the fly in Kubuntu/Ubuntu Gutsy Gibbon, but if you use the default config with "network manager", it can't connect to your DHCP server, and forget about WEP or WPA too..

So yeah, just get rid of network-manager and install wicd :

sudo apt-get remove network-manager

sudo kate /etc/network/interfaces
or :
sudo gedit /etc/network/interfaces

get rid of anything but :

auto lo
iface lo inet loopback

now install wicd

sudo apt-get install wicd

that's it, wicd works with encryption too

Thursday, August 02, 2007

aMule trick : import known files after fresh linux install

If like me, you regularly scan the eDonkey network for new files about a specific subject, you probably downloaded the same files over and over again after all the settings were lost.

Well, it's over now, there's a file "known.met" that stores all the filenames that were already downloaded so you can put your old file in the new .aMule directory after you installed a new fresh distro.

newsguys is a scam

Do NOT use newsguy.com, it's a scam. You can't cancel at any time, there's nothing in the interface to cancel and they will not answer your messages.

Avoid this company.

Wednesday, August 01, 2007

Request to the authors of Par2GUI , Gpar2 and PyPar2

Links :
Par2GUI
Gpar2
PyPar2

Thanks for the good work guys, but here's a request :

If I have a set of split file like those :

myfile.avi.par2
myfile.avi.vol00+1.PAR2
myfile.avi.vol01+2.PAR2
myfile.avi.001
myfile.avi.002
myfile.avi.003
myfile.avi.004

When we click on any par2 file, your front-end should be able to find the split files as additional blocks ( par2 r myfile.avi.par2 myfile.avi.* ) and join them back together, that's how they do it with Quickpar and Windows.

Check out the usenet binaries tutorial for more references.

Thanks in advance guys.

Wednesday, February 22, 2006

Samsung E700 CMOS sensor

Wow, if I break my Samsung E720 cellphone, I hope they will document this baby :




"CMOS Camera Module - 640x480

Price: $19.95

This is a 640x480 pixel resolution CMOS camera used in the Samsung E700 cellular phone. While 0.3 mega pixels may not sound like a lot, this module is one of the smallest, lowest cost CMOS imaging modules currently available to the embedded market.
(...)

Therefore - we will be offering a $200 in-store gift certificate to the first customer who can adequately document and report their successful single-image capture using this module. We would be thrilled to post your mug and forever immortalize you on the SFE site (well, for a day or two anyway). We will be working to reverse engineer the unit and encourage all customers to work together through the SFE support forum."




LINK

Tuesday, February 07, 2006

Batch convert a huge number of jpg images into one single pdf file

1 - Convert all the jpg files into pdf files with ImageMagick :

$ for i in *.jpg; do convert $i $i.pdf; done

2 - Merge, concantenate, join all the pdf files into one with pdftk :

$ pdftk *.pdf cat output output.pdf



Note : convert from ImageMagick won't work if there are too many files or too little memory :

$ convert *.jpg output.pdf

Wednesday, January 25, 2006

Mass par2 repair amazingly simple.

$ echo *.par2

or to get one filename per line :

$ for i in *.par2; do echo $i; done

So to mass-repair everything in a directory simply type :

$ for i in *.par2; do par2repair $i; done


EDIT : only works if the extension in "vol**+**.PAR2" is capitalized :-(

Saturday, January 14, 2006

NGET : daily radio show downloader

A script posted by someone on alt.binaries.h****-s****, to see how nget works.


#!/bin/sh

######################################
# getstern2.sh (updated for siruis) 2006-01-12 8:46:40
#
# fetch today's st3rn show from usenet. depends on the
# program `nget'
#
######################################

## CONFIGURATION
STERN_DIR="/usr/home/share/st3rn" # Directory to place downloaded shows into
DATE_PREFIX="`date +%Y-%m-%d`" # Today's date in YYYY-MM-DD format

## CHECK COMMAND LINE ARGUMENT
if [ "${1}" ] ; then
DATE_PREFIX="${1}"
echo "Using ${1} for DATE_PREFIX"
fi

## CHECK FOR NGET
if [ ! "`which nget`" ] ; then
echo "Error: nget not installed"
exit 1
fi ;

## CHECK FOR STERN DIRECTORY
if [ ! -d "${STERN_DIR}" ] ; then
echo "Error: ${STERN_DIR}: directory doesn't exist"
exit 1
elif [ ! -w "${STERN_DIR}" ] ; then
echo "Error: ${STERN_DIR}: you do not have write permission"
exit 1
fi

## CLEAN OUT NGET CACHE
if [ ! -d "${HOME}/.nget5" ] ; then
echo "Error: ${HOME}/.nget5: directory not found"
exit 1
elif [ ! -w "${HOME}/.nget5" ] ; then
echo "Error: ${HOME}/.nget5: you do not have write permission"
exit 1
fi
rm -f $HOME/.nget5/*

## WORK IN TEMP STERN DIR
if [ ! -d "/tmp/stern" ] ; then
mkdir /tmp/stern
fi
cd /tmp/stern

## TRY TO GET P4XTON FUDG3 VERSION
nget -g alt.binaries.haward-sturn -r ${DATE_PREFIX}-cf.mp3 > fetch-log
if [ "`ls|grep ${DATE_PREFIX}-[Cc][Ff].mp3`" != "" ] ; then
mv ${DATE_PREFIX}*.mp3 ${STERN_DIR}/${DATE_PREFIX}-CF.mp3
rm -f *.txt
echo "${0}: Success!"
exit 0
fi

echo "${0}: Download Failed"
exit 1

Usenet binaries with Pan

This is a scoring script that I use on some huge groups like alt.binaries.multimedia or alt.binaries.tv and it's much quicker than using the interface. Pan is compatible with the PCRE "Perl Compatible Regular Expressions".

Quick example :

$ score dead.like.me
ADDED :

[^alt\.binaries\.multimedia|alt\.binaries\.tv$]
Score: =-9999
Subject: dead.like.me.S\d\dE\d\d|dead.like.me.\dx\d\d|dead.like.me.\d\d\d


That way all the files called like "dead like me S01E22" or "dead-like-me.1x11" or "dead.like.me.104" are scored -9999 and I can save some RAM by reading only the headers scored 0. I can also delete all the headers scored -9999 ( ignored ) all at the same time.

Here's the "score" script to put in your /home/you/bin directory. The hardcoded things need to be changed ( path, group name )

#!/usr/bin/python
import sys

scorefile = "/home/you/News/Score"

group = "^alt\\.binaries\\.multimedia|alt\\.binaries\\.tv$"
arg = sys.argv[1]
score = arg+'.S\\d\\dE\\d\\d|'+arg+'.\\dx\\d\\d|'+arg+'.\\d\\d\\d'

f=open(scorefile, 'a')

f.write( "\n" + "[" + group + "]\n" )
f.write( "\t" + "Score: =-9999" + "\n" )
f.write( "\t" + "Subject: " + score + "\n\n" )
f.close

print "ADDED :"
print "\n" + "[" + group + "]"
print "\t" + "Score: =-9999" + "" print "\t" + "Subject: " + score

Tuesday, January 10, 2006

Samsung SGH-E720 with Linux

It works ! Almost.

I first bought a random USB Bluetooth dongle called Trendnet TBW-101UB. As expected it was detected automatically by Mandriva 2006, but then the real pain in ass began.

Let's start with the phone settings :

Bluetooth
1 - Activation : On
2 - My devices : localhost-0 ( see below )
3 - My phone's visibility : On
4 - My phone's name : SGH-E720
5 - Secure mode : Off


Since I use KDE I used the kdebluetooth package of my distro, then I changed the bluepin utility of Bluez to Kbluepin like described in the kde-bluetooth FAQ.
Then I somehow managed to exchange PIN numbers and save the computer ( called localhost-0 in the phone ) as an authorized device, don't ask me how, and that's it, nothing else worked within kde-bluetooth, worse it completely screwed up something with KDE, some KDE-related processes started to crash, the service called "dm" was also impossible to turn off.

I don't know why I started to try out this how-to. It can sound stupid since I use Mandriva not Ubuntu, KDE not Gnome, and a Samsung phone not Nokia, but the OBEX protocole is actually the same and it worked so, what the hell !

So here's what I did. See the original how-to for more details.

Note that the bluetooth service is still running but not kde-bluetooth.

$ su
$ urpmi gnome-bluetooth bluez-utils
# gnome-obex-server is already in gnome-bluetooth
$ modprobe l2cap
$ modprobe rfcomm
$ mknod /dev/rfcomm0 c 216 0
$ hcitool scan

hcitool scan
Scanning ...
00:12:47:AC:57:99 SGH-E720

$ vi /etc/bluetooth/rfcomm.conf

# with vi I changed the stuff to this : ( don't ask me about the channel 10 I have no idea of what it is )

rfcomm0 {
# Automatically bind the device at startup
bind no;

# Bluetooth address of the device
device 00:12:47:AC:57:99;

# RFCOMM channel for the connection
channel 10;

# Description of the connection
comment "Example Bluetooth device";
}


$ sdptool add --channel=10 OPUSH

$ rfcomm bind /dev/rfcomm0 00:12:47:AC:57:99 10

$ gnome-obex-send /home/zoby/Desktop/file.mp3

And it worked !!!! It showed a prompt on both the phone and the computer and the file transfer began.

All the rest of the how-to didn't work, that is how to transfer pictures from the phone to the computer with gnome-obex-server. Too bad. But I'm glad I can fill the 80Meg with mp3s now.

And like the guy said, do not forget that "Everytime that you reboot you must re apply this things (which you could insert into a boot-script)" :

modprobe l2cap
modprobe rfcomm
mknod /dev/rfcomm0 c 216 0
sdptool add --channel=10 OPUSH
rfcomm bind /dev/rfcomm0 YOUR_PHONE_ADDRESS 10



EDIT 2006/01/30

Cool.

Today I tried Ubuntu Live CD and tried again to make it work, and the symptoms were exactly the same as when using Mandriva/gnome-bluetooth, the transfer starts but stops after 10 seconds, but better than with Mandriva since before I had to restart the phone between each attempt. So it's a little better than with then Mandriva packages.

But this time I found a cool trick.
So, when the transfer stops after 10 seconds, I can make it restart by doing :

Menu, Settings, 6 Bluetooth, 2 My devices, ubuntu-0 ( or whatever name ), Options, Service list, Object list, Refresh.

Everytime the transfer stops, press Refresh. Yeah, it's annoying as hell, I know. I think something's wrong with this phone, but it might be a software or a dongle problem, I can't be sure.

I will try it with my mandriva later, and also I still have to transfer the pictures from the phone to the computer, so stay tuned. It's a time consuming process so it might take some time.



EDIT :
With Ubuntu, I forgot the line :
rfcomm bind /dev/rfcomm0 YOUR_PHONE_ADDRESS 10
and it worked better ( no need no refresh all the time )
Weird...




List of phones related : Samsung SGH-D800 SGH-D500 SGH-X810 SGH-S410 SGH-E860 SGH-E880 SGH-D600 SGH-E730 SGH-E620 SGH-E730 SGH-E520

Monday, January 02, 2006

ISO files with Linux

In the Linux world, people usually just mount their ISO images by typing as root :

$ mkdir /mnt/isotmp
$ mount isofile.iso /mnt/isotmp -o loop

And once they're done, unmount the virtual disk :

$ umount /mnt/isotmp

This can be very annoying.


UNISO

Here's another solution. This is a script in Perl that I found somewhere.
It uses isofile from the cdrecord-isotools package to extract the ISO file and you don't need to be root to execute it.


#!/usr/bin/perl
# Copyright (C) 2003 Tiago Cogumbreiro
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This file is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this file; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA

use strict;
use warnings;
our $VERSION = "0.1b";
our $ISOINFO = "isoinfo";
our $EXTRACT_COMPRESSED_FS = "extract_compressed_fs";
our $dest_dir = "";
our $iso = "";
our $do_chmod = 1;
our $do_cloop = 0;
our $tmp_iso = "/tmp/$$.iso";

sub usage {
print "Usage: $0 [-d ] \n";
print "\t-d \tthe destination directory\n";
print "\t-m\t\t\tdon't chmod files, usefull when extracting non Rockridge isos\n";
print "\t-c\t\t\textract from a cloop file instead of an iso\n";
print "\t-t \t\twhen extracting from a cloop we'll need to create a temporary file, define the temporary file with this argument\n";
}
# converts a string mode to a number mode
sub cvt_mode {
my ($str) = @_;
my $ret = 0;
if (substr($str, 0, 1) eq "r") {
$ret += 4;
}
if (substr($str, 1, 1) eq "w") {
$ret += 2;
}
if (substr($str, 2, 1) eq "x") {
$ret += 1;
}
return $ret;
}
# extracts a file from an iso
sub extract_file {
my ($curr_dir, $dest_dir, $line) = @_;
print "$line\n";
my $mode = substr($line, 0, 10);
my $file = substr($line, 67);
my $target = $dest_dir.$curr_dir.$file;
if((not $file =~ /\. */ or not $file =~ /\.\. */) and substr($mode, 0, 1) ne "d" ) {
print "$target\n";
if(substr($mode, 0, 1) eq "l") {
# create a link
my($src, $dst) = split(" -> ", $file);
print "ln -s $dst $dest_dir$curr_dir$src\n";
system "ln -s $dst $dest_dir$curr_dir$src";
unless($? == 0) {
print "Error while extracting symbolic link\n";
exit 1;
}
print "$file\n";
} else {
# Extract a regular file
system "$ISOINFO -i $iso -x /$curr_dir$file > $target";
# Correct mode
# Convert string to numeral mode
my $real_mod = cvt_mode(substr($mode, 1));
$real_mod .= cvt_mode(substr($mode, 4));
$real_mod .= cvt_mode(substr($mode, 7));
# apply conversion
# TODO add the SUI, SGI, sticky
# TODO chown
# TODO use perl's chmod
if ($do_chmod) {
system "chmod 0$real_mod $target";
}
}
}
}



# Parse arguments
while ((scalar @ARGV) gt 0) {
my $arg = shift(@ARGV);
# user don't want to chmod
if ($arg eq "-m") {
$do_chmod = 0;
# we'll be extracting from a cloop file instead
} elsif ($arg eq "-c") {
$do_cloop = 1;
# get the temporary file
} elsif ($arg eq "-t") {
$arg = shift(@ARGV);

unless($arg) {
usage();
exit 1;
}
$tmp_iso = $arg;
# user wants to set a destination dir
} elsif ($arg eq "-d") {

$arg = shift(@ARGV);

unless($arg) {
usage();
exit 1;
}
$dest_dir = $arg;
} else {
$iso = $arg;
}
}

unless($iso) {
usage();
exit 1;
}


# If we are extracting from a cloop file we'll need to extract
# a temp iso to extract the data from it, unfornatly isoinfo has
# no input redirection arg
if($do_cloop) {
system "$EXTRACT_COMPRESSED_FS $iso > $tmp_iso";
if($? != 0) {
print "Error converting cloop file to iso!\n";
exit 1;
}
$iso = $tmp_iso;
}

# Get the file list
my @file_list = split("\n", `$ISOINFO -R -l -i $iso`);

my $curr_dir = "";
foreach(@file_list) {
# ignore empty lines

# Get the current directory
if(/Directory listing of /) {
$curr_dir = substr($_, 22);
if($curr_dir) {
print("$dest_dir$curr_dir\n");
mkdir $dest_dir.$curr_dir;
}
} elsif ($_) {
extract_file($curr_dir, $dest_dir, $_);
}
}




One day though, it didn't work on one particular ISO file. So I stopped using it and made a script that would work everytime using the mount command.

This new script must be executed as root ( so link it to /usr/bin might be a good idea with ln uniso /usr/bin/uniso) and it will give 777 permissions to the extracted files ( read, write, exe for all users/groups ). Pass the name of the ISO file as argument and it will extract it a new directory.

A directory /mnt/isotmp will also be created.


#!/usr/bin/python
import sys, os

isofile = sys.argv[1] # command line argument

# check iso extension
if isofile.find('.iso') == -1: sys.exit('no iso file')

# check if /mnt/isotmp exists and create it
if os.path.exists( "/mnt/isotmp" ) == False : os.system('mkdir /mnt/isotmp')

# remove the extension '.iso'
folder = isofile[0:isofile.find('.iso')]

isofile = '\'' + isofile + '\'' # add ' '
folder = '\'' + folder + '\'' # add ' '

# mount the iso file to /mnt/isotmp/
os.system('mount ' + isofile+ ' /mnt/isotmp -o loop')

# creates a new folder in the current folder
os.system( 'mkdir ' + folder )

# copies th mounted directory into the new folder
os.system( 'cp -R /mnt/isotmp/* ' + folder )

# changes owner, group, and permissions
# username = os.environ['USER']
# os.system( 'chown -fhR username ' + folder )
# os.system( 'chgrp -fhR username ' + folder )
# os.system( 'chmod -R u+w,go-w ' + folder )

os.system( 'chmod -R 777 ' + folder )

# unmount the iso file
os.system( 'umount ' + ' /mnt/isotmp' )



To transform this new uniso script into an iso2tar command-line just add at the end of the program :

os.system( "tar cvf " + folder + ".tar" + folder )
os.system( 'chmod -R 777 ' + folder + '.tar' )


To transform it into an iso2tar.gz command-line :

os.system( 'tar cvfz ' + folder + '.tar.gz' + folder )
os.system( 'chmod -R 777 ' + folder + '.tar.gz' )


To transform it into an iso2tar.bz2 command-line :

os.system( 'tar cvfj ' + folder + '.tar.bz2' + folder )
os.system( 'chmod -R 777 ' + folder + '.tar.bz2' )


To transform it into an iso2zip command-line :

os.system( 'zip -r' + folder + '.zip' + folder )
os.system( 'chmod -R 777 ' + folder + '.zip' )


To transform it into an iso2rar command-line :

Wait, you don't really want to do that, do you !!


If you know a better way to handle ISO files, please drop a comment ! ( no registration required )



EDIT 1 :
Check out this program : Kiso
Strangely you need to run it as root ( ??? ).











EDIT 2 :
The archiver "File-roller" can extract ISO file. Well, sometimes.


EDIT 3 :
http://www.acetoneteam.org/


Last updated : July 2007