ImportError “No Module named Setuptools”

curl -O http://python-distribute.org/distribute_setup.py
python distribute_setup.py
easy_install pip

ECC Javascript Crypto wrapper

ECC Crypto Wrapper for stanford javascript library. This wrapper includes hex encoding and decoding to better key sharing. Feel free to use or fork it.

django 1.5 quickstart installation


$ virtualenv mysite
$ cd mysite ; source bin/activate
$ cd lib
$ ln -s ln -s /usr/lib/i386-linux-gnu/libfreetype.so
$ ln -s ln -s /usr/lib/i386-linux-gnu/libz.so
$ ln -s ln -s /usr/lib/i386-linux-gnu/libjpeg.so
$ cd ..
$ pip install Django
$ pip install south
$ pip install pil
$ pip install Unipath
$ django-admin.py startproject mysite
$ cd mysite
$ mkdir static templates media
$ cd mysite ; mkdir settings ; cd settings ; touch __init__.py ; touch local.py stage.py production.py ; mv ../settings.py base.py ; cd ..
$ cd ..
$ django-admin.py startapp my_app
$ pip freeze > requirements.txt
$ touch README.rst
$ git init
$ echo "*.pyc" > .gitignore ; echo "bin/" >> .gitignore ; echo "lib/" >> .gitignore ; echo "include/" >> .gitignore
$ git add .

Create databases:


# mysql -u root -p
#> CREATE USER '$PROJECTNAME'@'localhost' IDENTIFIED BY '$PROJECTNAME';
#> CREATE DATABASE IF NOT EXISTS $PROJECTNAME DEFAULT CHARACTER SET utf8;
#> GRANT ALL ON $PROJECTNAME.* TO '$PROJECTNAME'@'localhost';FLUSH PRIVILEGES;

Installing psycopg2 into virtualenv

When you run pip install psycopg2 from within your virtualenv you will receive following error:


$ pip install psycopg2
Downloading/unpacking psycopg2
Running setup.py egg_info for package psycopg2

Error: pg_config executable not found.

Please add the directory containing pg_config to the PATH
or specify the full executable path with the option:

python setup.py build_ext --pg-config /path/to/pg_config build ...

or with the pg_config option in 'setup.cfg'.
Complete output from command python setup.py egg_info:
running egg_info

writing pip-egg-info/psycopg2.egg-info/PKG-INFO
writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt
writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt
warning: manifest_maker: standard file '-c' not found

Error: pg_config executable not found.

Please add the directory containing pg_config to the PATH
or specify the full executable path with the option:

python setup.py build_ext --pg-config /path/to/pg_config build ...

or with the pg_config option in 'setup.cfg'.

----------------------------------------
Command python setup.py egg_info failed with error code 1

To solve this, just install apt-get install libpq-dev.

ffmpeg_ffmpeg-php_hosting

Encoder (codec none) not found for output stream #0:1

ffmpeg is a great tool to convert videos and to create snapshots from a video. But on every project Im facing the same problem: missing codecs. Here is the solution for this problem:

$ sudo add-apt-repository ppa:jon-severinsson/ffmpeg
$ sudo apt-get update
$ sudo apt-get install ffmpeg
$ sudo apt-get install libavcodec-extra-53

The extra-xx version can change and depends on your current linux distro release.

Android captured almost 70% global smartphone market share in 2012, Apple just under 20%

Its nice to see that android is dominating the smartphone market, but mobile apps vendors are still receiving more iPhone projects. Seems that apple is still well known.

Mega-Encryption

The article describes the two used encryption – AES for user storage and RSA for collaboration file sharing. -  ”On the other hand, even if the service doesn’t know those blocks of data happen to be The Hobbit, the service does know which users own those deduplicated blocks, and if one user is implicated, there’s proof against all the others, too.”

Mega Vs Dropbox Vs Boxnet: Features Compared

nice comparison between the cloud online storage services. It would be great to add Google Drive and Skydrive … Mega blows away the competition due to its cost/per GB being the lowest.

Tuning the network

Tuning the network

Your system imposes a variety of thresholds and limits on TCP traffic, dictated by its kernel parameter configuration. The default settings are designed for accommodating generic networking use. They are not necessarily geared up for high-volumes of short-lived connections handled by a web server. These settings are important for a realtime enviroment:

net.ipv4.ip_local_port_range='1024 65000'
net.ipv4.tcp_tw_reuse='1'
net.ipv4.tcp_fin_timeout='15'
net.core.netdev_max_backlog='4096'
net.core.rmem_max='16777216'
net.core.somaxconn='4096'
net.core.wmem_max='16777216'
net.ipv4.tcp_max_syn_backlog='20480'
net.ipv4.tcp_max_tw_buckets='400000'
net.ipv4.tcp_no_metrics_save='1'
net.ipv4.tcp_rmem='4096 87380 16777216'
net.ipv4.tcp_syn_retries='2'
net.ipv4.tcp_synack_retries='2'
net.ipv4.tcp_wmem='4096 65536 16777216'
vm.min_free_kbytes='65536'

Stanford Javascript Crypto Library

MEGA is using a mix of flash and the stanford javascript crypto library to encrypt the uploaded documents using HTML5 File Api.