Follow me
-
Recent Posts
calendar
December 2024 M T W T F S S 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 Recent Comments
- Stan on python argparse issues with the help argument (TypeError: %o format: a number is required, not dict)
- Cormac on Pandas : how to compare dataframe with None
- LP on AWK: the substr command to select a substring
- jrab on python argparse issues with the help argument (TypeError: %o format: a number is required, not dict)
- How to disable SSL verification for urlretrieve? – Peter's blog on python: certificate verified failed
Archives
Categories
Meta
Author Archives: Thomas Cokelaer
Installing repositories under Centos 6.2 to get ipython, R and other packages
I installed Centos 6.2 and tried to install some packages such as ipython or R but they were not available like many other useful packages that are available by default in other distribution such as Fedora. The solution is to … Continue reading
SED: replace a pattern in all files in one command
I have a bunch of c files and I want to change the first line that appears as //something into /*something Using sed, you can use the command ‘s/old_pattern/new_pattern/g’ where -e stands for edition, and -i to apply the changes. … Continue reading
crontab usage
Under Linux/Unix, tasks can be run automatically at a given time and regular intervals. Those tasks are store within the crontab (CRON TABle) that is a file which contains the schedule of cron tasks. Crontab Restrictions To prevent a user … Continue reading
SVN properties
SVN allows to store some useful keywords which can be set, the value of which will be substituted for ‘tags’ in the file itself. For instance, if the Id keyword is set, place this line in your code __revision__ = … Continue reading
python: how to flatten a nested list
Simple nested list of strings Suppose that you have a simple nested list. Simple in the sense that there is only one level: data = [[’a’,’b’], [’c’], [’d’]]data = [[‘a’,’b’], [‘c’], [‘d’]] you can use the operator module and reduce … Continue reading
ssh on remote host without typing the password
When you connect to a remote host with SSH, you need to enter the password, which can be cumbersome on the long term when connections are frequent. Here is a solution to make the connection automatic. First, if not already … Continue reading
vim usage: wrapping, spelling, completion, indentation, …
code folding To fold a number of lines (5 for example) press zf5j. To fold code within curly brackets use za The folded lines will be replaced in the buffer with a line that looks like: +—– 5 lines: }—– … Continue reading
Python: how to share a local directory on the web
A simple way to share a local directory on internet (temporarily) can be performed with Python. First, go to the directory you want to share and then type: [admin@localhost Work] python -m SimpleHTTPServer 7000 Serving HTTP on 0.0.0.0 port 7000 … Continue reading
Malloc and Casting
In C, the malloc function is used to allocate memory. Its prototype is: void *malloc(size_t size);void *malloc(size_t size); It returns a void pointer (void *), which indicates that it is a pointer to a region of unknown data type therefore … Continue reading
vim: replace tabs by spaces
In the vim editor, the default behaviour of the tab key is to print a tab … not surprising. When coding, you may prefer tab to be replaced by spaces (because this is your coding style for instance). This feature … Continue reading