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>…

Tokenize c, c++ and objective-c files with clang

// tokenizer.cc // Copyright (c) 2013 Shinya // The MIT License (MIT) http://opensource.org/licenses/mit-license.php #include <iostream> #include <clang-c/Index.h> void DisplayTokens(const CXTranslationUnit& tu) { CXCursor cursor = clang_getTranslationUnitCursor(tu)</clang-c/index.h></iostream>…

Find tabs with grep

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

Install gflags

gflags, commandline flags module for C++. Environment Ubuntu 12.04 64bit Install gflags. Download gflags-2.0.tar.gz $ tar zxvf gflags-2.0.tar.gz $ cd gflags-2.0 $ ./configure $ make $ sudo make install $ sudo ldconfig $ cd .. $ rm -rf gfla…

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 Protocol Buffer

OSS

Ubuntu 12.04 64 bits wget 'http://code.google.com/p/protobuf/downloads/detail?name=protobuf-2.4.1.tar.bz2' -O protobuf-2.4.1.tar.bz2 tar xvf protobuf-2.4.1.tar.bz2 cd protobuf-2.4.1/ ./configure make make check sudo make install cd .. rm -…

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…