Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Jianwei Han hanjianwei

🏠
Working from home
View GitHub Profile
View org-syntax-cheatsheet.org

Markup Cheat sheet for Org-mode

Heading 1

Heading 2: Set a deadline and a schedule

[66%] Heading 3: a list with checkboxes

  1. [x] task 1
  2. [X] task 2
  3. [x] task 3
@hanjianwei
hanjianwei / csv2json.py
Created Oct 5, 2013
CSV to JSON converter
View csv2json.py
#!/usr/bin/env python
import csv
import json
import sys
if __name__ == "__main__":
if len(sys.argv) != 2:
print "Usage: %s input" % sys.argv[0]
sys.exit(1)
@hanjianwei
hanjianwei / pdftitle.py
Last active Dec 9, 2021
Extract title from pdf file.
View pdftitle.py
#!/usr/bin/env python
"""
Extract title from PDF file.
Depends on: pyPDF, PDFMiner.
Usage:
find . -name "*.pdf" | xargs -I{} pdftitle -d tmp --rename {}
@hanjianwei
hanjianwei / acm.coffee
Last active Aug 29, 2015
Retrieve doi list from table of contents page (ACM Digital Library)
View acm.coffee
#!/usr/bin/env phantomjs
fs = require 'fs'
webPage = require 'webpage'
system = require 'system'
printDoi = (url, remains) ->
page = webPage.create()
redirectURL = null
@hanjianwei
hanjianwei / check_unity.c
Created Oct 21, 2015
Check if a Windows exe built with Unity.
View check_unity.c
#include <stdio.h>
#include <string.h>
int check_unity(const char *filename)
{
FILE *f = fopen(filename, "rb");
const char *s = "UnityPlayer";
char buf[20];
int len = strlen(s);
int is_unity = 0;
@hanjianwei
hanjianwei / build_opencv.sh
Created Apr 1, 2016
Build OpenCV for Android and Linux
View build_opencv.sh
#!/usr/bin/env bash
OPENCV_DIR=../../src
INSTALL_DIR=$HOME/adas/3rdparty
TEST_OPTS="-DBUILD_TESTS=OFF \
-DBUILD_PERF_TESTS=OFF \
-DBUILD_EXAMPLES=OFF"
PKG_OPTS="-DWITH_OPENEXR=OFF \
@hanjianwei
hanjianwei / karabiner.json
Last active Mar 29, 2020
My karabiner elements settings
View karabiner.json
{
"global": {
"check_for_updates_on_startup": true,
"show_in_menu_bar": true,
"show_profile_name_in_menu_bar": false
},
"profiles": [
{
"complex_modifications": {
"parameters": {
View install-trojan-go.sh
#!/bin/bash
set -euo pipefail
function prompt() {
while true; do
read -p "$1 [y/N] " yn
case $yn in
[Yy] ) return 0;;
[Nn]|"" ) return 1;;
esac