Skip to content

Instantly share code, notes, and snippets.

View hanjianwei's full-sized avatar
🏠
Working from home

Jianwei Han hanjianwei

🏠
Working from home
View GitHub Profile
@hanjianwei
hanjianwei / acm.coffee
Last active August 29, 2015 14:01
Retrieve doi list from table of contents page (ACM Digital Library)
#!/usr/bin/env phantomjs
fs = require 'fs'
webPage = require 'webpage'
system = require 'system'
printDoi = (url, remains) ->
page = webPage.create()
redirectURL = null
@hanjianwei
hanjianwei / org-syntax-cheatsheet.org
Created October 27, 2012 08:05 — forked from wdkrnls/org-syntax-cheatsheet.org
Org-mode Syntax Cheat sheet

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 / check_unity.c
Created October 21, 2015 08:09
Check if a Windows exe built with Unity.
#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 April 1, 2016 08:57
Build OpenCV for Android and Linux
#!/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 March 29, 2020 15:02
My karabiner elements settings
{
"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 / install-trojan-go.sh
Created August 11, 2021 13:33
Install trojan-go
#!/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 / csv2json.py
Created October 5, 2013 09:51
CSV to JSON converter
#!/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)

Keybase proof

I hereby claim:

  • I am hanjianwei on github.
  • I am hanjianwei (https://keybase.io/hanjianwei) on keybase.
  • I have a public key ASCbfQA_1_-sUkP1t11ZC_1sRAWNsDzsP4RLa69AXDNvAQo

To claim this, I am signing this object:

@hanjianwei
hanjianwei / ghost.js
Created June 16, 2023 06:35
Taobao Ghost URL
javascript: (() => {
const product_id = new URL(window.location).searchParams.get('id');
const ghosturl = 'https://h5.m.taobao.com/awp/core/detail.htm?id=' + product_id + '&fpChannel=16&ex_fpChannel=16&ali_refid=a3_430915_1007:1418530027:U:635407592199_0_3337281265:dabf06ee5d568e16095118f52126d059&ali_trackid=141_dabf06ee5d568e16095118f52126d059&spm=a21i0.mall-search.goods-fall.11&visa=1305a108050c1a44&fpChannelSig=73cd170bee8a7f2e2ffb8d9e84c573ea21d3443b&ex_fpChannelSig=73cd170bee8a7f2e2ffb8d9e84c573ea21d3443b&chInfo=ch_share__chsub_qrcode&apshareid=50CC205D-C4F4-4508-B052-640C0BE95BFE';
prompt('Copy Ghost URL:', ghosturl);
})();
@hanjianwei
hanjianwei / pdftitle.py
Last active February 28, 2024 22:14
Extract title from pdf file.
#!/usr/bin/env python
"""
Extract title from PDF file.
Depends on: pyPDF, PDFMiner.
Usage:
find . -name "*.pdf" | xargs -I{} pdftitle -d tmp --rename {}