Skip to content

Instantly share code, notes, and snippets.

@twmht
twmht / autoload.eclim.vim
Created May 11, 2012 15:32
auto switch between autocomplop and neocomplopcache in eclim
" In function! eclim#ExecuteEclim
....
let g:eclimd_running=1
""" Because the snippet may execute multiple times, I just make the auto-switch between these two plugins execute only one time
if !exists('g:mht_enableThePlugin')
"""all the eclimrc settings will store in eclimrc.vim, not vimrc for management-easy reason
source ~/eclimrc.vim
let g:mht_enableThePlugin = 1
http://www.airitilibrary.com/searchdetail.aspx?DocIDs=U0024-1711200916334278
@twmht
twmht / .vrapperrc
Created November 16, 2013 06:36
configuration file of vrapperrc
set autoindent
set ignorecase
set smartcase
set regexsearch
set hlsearch
set incsearch
set saney
set number
set autochdir
inoremap jj <ESC>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Node.js-get</title>
</head>
<body>
<h1>Register page</h1>
<form id="signup" method="GET" action="http://localhost:5566/Signup">
<!doctype html>
<html>
<head>
<meta charset = "utf-8">
<link rel = "stylesheet" href = "lounge.css">
<script src = "lounge.js"></script>
</head>
<body>
<div id = "chatlog"></div>
<input type = "text" id = "message"></input>
@twmht
twmht / install.sh
Created November 25, 2013 14:22
install java in debian
sudo echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list
sudo echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886
sudo apt-get update
sudo apt-get install oracle-java7-installer
sudo apt-get install oracle-java7-set-default
@twmht
twmht / .bashrc
Created December 4, 2013 15:00
man page with vim
man () {
/usr/bin/man $@ | col -b | vim -R -c 'set ft=man nomod nolist' -
}
//Brian Kernighan’s Algorithm:
/*
Subtraction of 1 from a number toggles all the bits (from right to left) till the rightmost set bit(including the righmost set bit). So if we subtract a number by 1 and do bitwise & with itself (n & (n-1)), we unset the righmost set bit. If we do n & (n-1) in a loop and count the no of times loop executes we get the set bit count.
Beauty of the this solution is number of times it loops is equal to the number of set bits in a given integer.
*/
#include<stdio.h>
/* Function to get no of set bits in binary
representation of passed binary no. */
@twmht
twmht / index.html
Created April 2, 2014 14:27
Simple ajax with python
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js">
</script>
<script>
function ProcessSimpleCgi()
{
param1Data = $("#param1").val();
param2Data = $("#param2").val();
@twmht
twmht / multiprocessing1.py
Created April 3, 2014 13:35
Multiprocessing
import urllib2
from multiprocessing.dummy import Pool as ThreadPool
urls = [
'http://www.python.org',
'http://www.python.org/about/',
'http://www.onlamp.com/pub/a/python/2003/04/17/metaclasses.html',
'http://www.python.org/doc/',
'http://www.python.org/download/',
'http://www.python.org/getit/',