Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Jianwei Han hanjianwei

🏠
Working from home
View GitHub Profile
@hanjianwei
hanjianwei / install-trojan-go.sh
Created August 11, 2021 13:33
Install trojan-go
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
@hanjianwei
hanjianwei / karabiner.json
Last active March 29, 2020 15:02
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": {
@hanjianwei
hanjianwei / build_opencv.sh
Created April 1, 2016 08:57
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 / check_unity.c
Created October 21, 2015 08:09
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 / acm.coffee
Last active August 29, 2015 14:01
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 / pdftitle.py
Last active December 9, 2021 05:00
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 / csv2json.py
Created October 5, 2013 09:51
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 / org-syntax-cheatsheet.org
Created October 27, 2012 08:05 — forked from wdkrnls/org-syntax-cheatsheet.org
Org-mode Syntax Cheat sheet
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