Linux

Delete metadata of an image file by using ExifTool

Abstract Delete metadata of an image file by using ExifTool on Ubuntu 12.04. The following command is useful to sanitize images before uploading and downloaded images. Install ExifTool $ wget http://www.sno.phy.queensu.ca/~phil/exiftool/Im…

Normalize file names

Abstract Normalize file names on Ubuntu 12.04.The following script and command: Normalize unicode characters. E.g. image①.jpg -> image1.jpg. Make the extension of a basename lower case. E.g. image.JPG -> image.jpg Strip the root of a basen…

Delete suspicious directories and files by using the find command

Abstract Delete suspicious directories and files by using the find command on Ubuntu 12.04. The following commands are useful to sanitize files which have been downloaded from a suspicious site. Commands # Set a target directory. $ TARGET_…

Call Python functions from C++ on Ubuntu 12.04

Code /home/shinya/py_example/mymain.py import sys def main(args): sys.stdout.write('Hello, world!\n'); if args: sys.stdout.write('{0}\n'.format(args)) /home/shinya/py_example/main.cc #include <Python.h> #include <cassert> #include <iostream> int main(int argc, char** </iostream></cassert></python.h>…

Call Java functions from C++ by using Java Native Interface (JNI) on Ubuntu 12.04

Code /home/shinya/jni_example/Main.java public class Main { public static void main(String[] args) { System.out.println("Hello, world!"); if (1 <= args.length) { System.out.println(args[0]); } } } /home/shinya/jni_example/main.cc #include <jni.h></jni.h>…

Find tabs with grep

$ grep -r $'\t' * References 逆引きUNIXコマンド/grepでタブを検索する方法 - Linuxと過ごす (Japanese)

Extending Python with C or C++

Wrapping a C library in Python. Environment Ubuntu 12.04 64bit Python 2.7 Install Python.h $ sudo apt-get install python2.7-dev Code // spammodule.c #include <Python.h> #ifdef __cplusplus extern "C" { #endif static PyObject* SpamError; static PyObje</python.h>…

Install HPN-SSH

Abstract Install High Performance SSH/SCP - HPN-SSH 5.9 to Cent OS 5.4 (32bit). Procedure Install dependencies yum install -y patch rpm-build openssl-devel glibc-devel krb5-devel gcc pam-devel Download and patch openssh wget http://ftp.jai…