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
Allocation 2D arrays in C (and freeing memory)
By convention, when dealing with 2D array, the first dimension refer to the rows, and the second to the columns. To create a 2D array (double pointer) in C, you first create a 1D array of pointers (rows), and then, … Continue reading
RPy2 substitute function does not work
I’m using rpy2 to call R package from Python, which works pretty well most of the time. Yet, I’ve encountered an issue with the R function called substitute that do not behave as expected when called from rpy2. Consider the … Continue reading
Set the default printer under linux
If you want to set the default printer, you can use the command line interface and type: export PRINTER=printer-nameexport PRINTER=printer-name If you want to set the default printer permanently, and if your shell is bash (most common by default), you … Continue reading
super() function in Python raises a TypeError
Playing with class inheritance, I came across an unexpected behavior of super() function, which is used in the inheritance process. Consider this simple example of a class MyGraph thah inherits from a DiGraph class from networkx: import networkx as nx … Continue reading
a2ps usage
a2ps is a unix tool that ease the formatting of text files before printing. a2ps inputfile -o output.psa2ps inputfile -o output.ps Print code that span over more than 80 columns. You will need to decrease the font size (-f 7), … Continue reading
How to generate a PDF reference of an R package
If you have the Rd files in a man directory, then in a shell command, you can use this command: R CMD Rd2dvi –pdf –title=’Test of foo’ -o /tmp/foo.pdf man/*.RdR CMD Rd2dvi –pdf –title=’Test of foo’ -o /tmp/foo.pdf man/*.Rd
pdf2ps font issues
Sometimes, when converting a PDF file to a PS file using ps2pdf, some fuzzy fonts may appear. A solution is to provide the fonts within the documents by using: pdf2ps -dEmbedAllFonts=true <input> <output>pdf2ps -dEmbedAllFonts=true <input> <output>
scp does not work: wrong bashrc
When I tried to use scp to copy a file on a distant machine: scp -v filename username@xxx.xxx.xxx:/home/usernamescp -v filename username@xxx.xxx.xxx:/home/username it looked as if the SCP command works but the file is not copied. The interactive option (-v) does … Continue reading
How to resize images with awk and convert
If photos in a directory are too large, you may want to use a script to automatically convert all the files into another format. AWK and convert tools can help you. The following command should convert all the files with … Continue reading