Posts with the category Programming Languages
perlbrew is a one-liner:
curl -L http://install.perlbrew.pl | bash
Add this lines to your
To get a stable perl distribution, do:
perlbrew install stable
To use it, run:
perlbrew list perlbrew switch perl-5.20.2
To upgrade to the latest stable Perl distribution at a later point:
iRoot is a product of the India-based Neutrino Observatory collaboration lead by Prof.Naba Mondal at the Tata Institute of Fundamental Research.
It is a simple plotting and analysis tool based on the popular ROOT from CERN and is primarily intended for analysis using the TTree structures in ROOT. iRoot is supported...
If you have an SQLite database file and want to check its structure (programmatically)
SELECT * FROM sqlite_master;
To do this via Python as simple as possible, run:
conn = sqlite3.connect("your/database.sqlite") c = conn<span...
search using SQL
SELECT * from bash_history where command LIKE '%modprobe%'
% is the wildcard character in SQL!
This is an iMacros script to extract transaction details on the online banking website of the German branch of the bank ING-DiBa. As this is mostly interesting to Germans, the following blog post is in German. If you want to read it in English, consider translating it using Google...
I do not particulary like SVN but sometimes I have to use it. The diff output on the Mac OS X command line usually is not colored which is annoying. The solution is to tell SVN it should use
colordiff instead. You can easily install colordiff using homebrew:
With FUSE - The Filesystem in Userspace you can mount all different kinds of remote / local filesystems on you Linux/Unix/Mac computer. Here are some implementations of interesting FUSE filesystems:
- SSHFS https://blog.philippklaus.de/2011/07/sshfs-on-mac-os-x-10-6-8-with-fuse4x/ works great!
- Encrypted Filesystem https://blog.philippklaus.de/2011/12/transparently-encrypt-folders-with-encfs/ works well!
- PicasaFUSE https://github.com/jonathanverner/picasafuse
- FuseFTP in Perl https://github.com/marcust/fuseftp
- ZFS-FUSE http://zfs-fuse.net/
- FlickrMS https://github.com/patrickjennings/FlickrMS
ezyfit can prevent you from buying the Curve Fitting Tool that Matlab does not come with by default. This is how I use it to fit data according to a function :
x=15:45 y = 30 +...
There seem to be quite a lot of problems with 16-bit grey scale TIFF images (especially with the Python Imaging Library - PIL). If you can, you may want to use FITS instead of TIFF. There are good and up-to-date libraries for Python: PyFITS.
For me, however, the FreeImage...
Hub is a useful extension to make git GitHub aware.
hub introduces git to GitHub
hub teaches git about GitHub
brew install hub
MacFSEvents is an up-to-date solution to monitor directories for changes on Mac OS X when using the scripting language Python. It is a binding to FSEvents, Mac OS X's filesystem monitoring framework.
pip install macfsevents
from fsevents import Observer, Stream <span...
You can use the following Python function to convert a photon energy (in electron volts) to the corresponding wavelength (in nano meters):
def wavelength_from_energy ( electron_volts): """Returns a photon wavelength in nm from a photon energy given in eV.""" ...
SciPy (updated to CODATA 2010)
Installation (easiest using
- Install Fortran as described for your OS on http://www.scipy.org/Installing_SciPy (or via
brew install gfortranon Max OS X)
- Install SciPy itself:
pip install scipy
from scipy.constants import * print "The Planck constant h:", <span...
Installation of the pre-built binaries for OS X
This is a good way if you have an up-to-date Python installation on your computer and
pip installed. It takes, however, some time (~ 20 mins for me) to install as it...
The builtin Python modules to work with markup languages can be found on http://docs.python.org/library/markup.html. For XML these are mainly DOM (incl. minidom), SAX and ElementTree.
A comparison of minidom and ElementTree including good examples can be found on http://mike.hostetlerhome.com/present_files/pyxml.html.
Other than the default Python modules there is also a very...
Requirements and Installation
You may want to have a look at its source code on GitHub.
The dependencies of watchdog...
Operating System Independent Solutions
- watchdog is a cross platform solution initiated by Gora Khargosh. Read my dedicated blog post for more information on this solution: Use the Python Module Watchdog to Monitor Directories for Changes
- Use Qt's QFileSystemWatcher (see this on how to use it with Python).
- Solution including...
update in 2014: The script from this blog post evolved into its own Python software repository on Github: pklaus/MaxiGauge. Please use that for the latest code and functionality.
I wrote a Python module for this pressure gauge controller. The module can be found on https://gist.github.com/1378695. Using the module...
To access devices that have a serial port using LabView, you should build a state machine (essentially a case structure inside a while loop, see this forum topic). More about that on http://zone.ni.com/devzone/cda/tut/p/id/3024#toc1.
- PID Controller on Wikipedia: http://en.wikipedia.org/wiki/PID_controller
- Python example (didn't have a close look into it): http://code.activestate.com/recipes/577231-discrete-pid-controller/
- Another Python example with a 3D visualization: http://www.chiefdelphi.com/forums/showthread.php?t=61874
- Python class
PIDControllerfrom the cgkit module (Python Computer Graphics Kit): http://cgkit.sourceforge.net/doc2/pidcontroller.html#PIDController
- PyPID: http://pypi.python.org/pypi/pypid/
Windows 7 ships with v2.0 of the Windows PowerShell. On a German Win7 installation you can start it via Start → Alle Programme → Zubehör → Windows PowerShell → Windows PowerShell (ISE).
Owner's manual: http://technet.microsoft.com/en-us/library/ee221100.aspx
Translating Simple DOS Commands to Powershell cmdLets<table class="table...
Yesterday, I had to prepare for an exam at the University but instead of learning for it I wrote a small tool to browse the unicode characters. You can have a look at it on http://pklaus.github.com/js-Unicode-Selector. It's fun...
The Bash is probably the most important shell and scripting language in the world as it is included with almost any operating system (excl. MS Windows). The automation that can be achieved with very predictable results is great even though the complexity of the scripts is somehow limited. Doing calculations...
On Wikipedia there is a Comparison of (x86) assemblers. You can sort the table by x86_64 capability.
Most x86 assemblers use Intel syntax. Here is a little comparison: http://asm.sourceforge.net/articles/linasm.html#Syntax
Most widely used assembler syntax.
At the end of the mnemonics you put a size suffix (one letter). To change...
Operators in C
Operators in C and C++: http://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B
C supports a rich set of operators, which are symbols used within an expression to specify the manipulations to be performed while evaluating that expression. C has operators for:
- arithmetic (
- equality testing (
- order relations (
The German VoIP provider Sipgate has a great offer for people who want to replace their landline with a modern internet based SIP telephony account. Sipgate offers an XML-RPC API to all its customers (you must at least have created a free 'basic' account). With the API, you...
You can use gitosis to allow people to collaborate on a project via git. Its a utility to allow read and write access based on SSH encryption keys. And you only need to create a single system account, not one for every contributor.
First, install gitosis:
su apt-get install gitosis
su easy_install virtualenv
And create your virtualenv :
mkdir ~/venv virtualenv --no-site-packages ~/venv/django-cooking source ~/venv/django-cooking/bin/activate
Now you can install a whole bunch of stuff to that virtual python environment:
easy_install django psycopg2 django-extensions werkzeug south reportlab pypdf html5lib pisa pil
When using virtualenv, you should also consider using virtualenvwrapper! It provides...
If you want to use SQlite3 databases with PHP you should probably use PDO.
Install it like this:
su apt-get install php5 php5-sqlite echo -e "\nextension=pdo.so\n" >> ../conf/php.ini
Note: You don't need any command like
pecl install pdo_sqlite or
pecl install pdo as PDO is now included in the package
Omitted SQL Language Features
you cannot choose table names from the keywords list!!!
enforce foreign keys
SQLite Foreign Key Trigger Generator: http://www.rcs-comp.com/site/index.php/view/Utilities-SQLite_foreign_key_trigger_generator
SQLite with Python
Admin tools / GUIs
Open Source, cross platform!
SQLite Database Browser
sudo apt-get install sqlitebrowser