Skip to content

Instantly share code, notes, and snippets.

@hanji
hanji / get_patches.py
Created July 9, 2014 16:19
get vim 7.4 patches
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os,tempfile,urllib
for i in range(1,359):
with open(os.path.sep.join((tempfile.gettempdir(),'7.4.'+ str(i).zfill(3))), 'wb') as f:
f.write(urllib.urlopen('ftp://ftp.vim.org/pub/vim/patches/7.4/7.4.%s' % str(i).zfill(3)).read())
@hanji
hanji / msvc12-vim64.bat
Created July 8, 2014 21:52
build 64-bit version of gvim using msvc12 toolchain.
::~msvc12-vim64.bat: build 64-bit version of gvim using msvc12 toolchain.
::~author: Ji Han
wget ftp://ftp.vim.org/pub/vim/patches/7.4/7.4.168
patch -p0 < 7.4.168
nmake -f Make_mvc.mak SDK_INCLUDE_DIR="C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include" MSVCVER=11.0 ^
CPU=AMD64 GUI=yes OLE=yes IME=yes CSCOPE=yes ^
@hanji
hanji / msvc10-vim64.bat
Created August 8, 2013 15:06
build 64-bit version of gvim using msvc10 toolchain.
::~msvc10-vim64.bat: build 64-bit version of gvim using msvc10 toolchain.
::~author: Ji Han
set PATH=C:\Perl64\bin;%PATH%
::~beginning of line~--do not insert blank lines or comments.
nmake -f Make_mvc.mak CPU=AMD64 GUI=yes OLE=yes IME=yes CSCOPE=yes ^
WINVER=0x0500 NETBEANS=no DEFINES="-DFEAT_PROPORTIONAL_FONTS" ^
LUA=C:\opt\lua DYNAMIC_LUA=yes LUA_VER=52 ^
TCL=C:\Tcl85-x64 DYNAMIC_TCL=yes TCL_VER=85 TCL_VER_LONG=8.5 ^
@hanji
hanji / mingw-vim.bat
Created August 8, 2013 15:04
build 32-bit version of gvim using mingw toolchain.
::~mingw-vim.bat: build 32-bit version of gvim using mingw toolchain.
::~author: Ji Han
set PATH=C:\mingw32\bin;C:\Perl\bin;%PATH%
mingw32-make -f Make_ming.mak ARCH=i686 STATIC_STDCPLUS=yes GUI=yes OLE=yes IME=yes CSCOPE=yes ^
LUA=C:/lua DYNAMIC_LUA=yes LUA_VER=52 ^
TCL=C:/Tcl DYNAMIC_TCL=yes TCL_VER=85 TCL_VER_LONG=8.5 ^
PERL=C:/Perl DYNAMIC_PERL=yes PERL_VER=516 ^
PYTHON=C:/python27 DYNAMIC_PYTHON=yes PYTHON_VER=27 PYTHON3=C:/python33 DYNAMIC_PYTHON3=yes PYTHON3_VER=33 ^
@hanji
hanji / rubyblue.vim
Created December 23, 2012 10:36
Vim Color Scheme
" rubyblue.vim --- vim color scheme
" Ji Han (jihan917<at>gmail<dot>com)
set background=dark
hi clear
if exists("syntax_on")
syntax reset
endif
let g:colors_name = "rubyblue"
@hanji
hanji / singleton.cc
Created October 21, 2012 19:12
Being single is not easy.
// double-checked locking singleton was an _incorrect_ model
// however, it has great influences, such that:
// the Java Memory Model changed in favor of it (since J2SE-1.5);
// Visual C++ changed 'volatile' semantics (since Visual C++ 2005).
// method 1 uses 'volatile'--VC++ only solution.
// method 2 uses 'thread_local'--portable C++11 solution.
// [you may opt for a much easier 'pthread_once()' solution on POSIX platforms.]
// (c) 2012 Ji Han
@hanji
hanji / touch.js
Created September 18, 2012 09:09
(WSH) file timestamp manipulation utility [revised version]
// touch.js --- file timestamp manipulation utility (like *nix touch)
// (c) Copyright 2012, Ji Han (hanji <at> outlook <dot> com)
// you are free to distribute it under the BSD license.
(function(){
if (WScript.Arguments.Length == 0){
// this script works for files, but not folders. (you need win32api to do that.)
// plus, there's no '-a' or '-m' options; it only touches the mtime.
WScript.Echo('touch [-c] [-r <reference_file> | -t <timestamp>] <files>');
@hanji
hanji / rename.js
Created September 16, 2012 15:04
bulk file renaming utility
// rename.js --- bulk file renaming utility (like *nix rename.pl)
// (c) Copyright 2012, Ji Han (hanji <at> outlook <dot> com)
// you are free to distribute it under the BSD license.
if (!Array.prototype.map) Array.prototype.map = function (f, t){
var o = Object(this);
var r = new Array(o.length >>> 0);
for (var i = 0; i < r.length; ++i){ if (i in o) r[i] = f.call(t, o[i], i, o) }
return r;
};
@hanji
hanji / touch.js
Created September 15, 2012 20:50
(WSH) file timestamp manipulation utility
// touch.js --- file timestamp manipulation utility (like *nix touch)
// (c) Copyright 2012, Ji Han (hanji <at> outlook <dot> com)
// you are free to distribute it under the BSD license.
(function(){
if (WScript.Arguments.Length == 0){
// this script works for files, but not folders. (you need win32api to do that.)
// plus, there's no '-a' or '-m' options; it only touches the mtime.
WScript.Echo('touch [-c] [-r <reference_file> | -t <timestamp>] <files>');
@hanji
hanji / .vimrc
Created September 9, 2012 19:30
vim configuration file
"vim configuration file
"(C) Copyright 2009-2012, Ji Han
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set fileencodings=ucs-bom,utf-8,gbk,big5,euc-jp,euc-kr,default
set encoding=utf-8
language message en_US.utf-8
set langmenu=en_US.utf-8
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""