Skip to content

Instantly share code, notes, and snippets.

@de1o
de1o / autohotkey.ahk
Created February 29, 2012 06:52
a bat script to dial vpn on windows
; CMD: connect/disconnect vpn
#v::
run, "your directory\dialvpn.bat"
return
@de1o
de1o / colaz.py
Created May 16, 2012 12:31
colaz
from xlwt import Workbook
def colaz(n, cnt, row):
if n == 1:
print cnt
row.write(1, str(cnt))
return 0
if n%2 == 0:
n = n/2
else:
@de1o
de1o / colazCalculatingTime.py
Created May 17, 2012 04:00
colazCalculatingTime
# colazCalculatingTime.py
import time
colazStopNumList = []
def colaz(n, cnt):
if n == 1:
colazStopNumList.append(cnt)
return 0
@de1o
de1o / output.py
Created June 7, 2012 01:46
output.py
initNum = int(raw_input("input the initial number:"))
delta = int(raw_input("input the delta:"))
cnt = int(raw_input("input the count number:"))
s = '0ps 0mv '
for i in range(cnt):
s += (str(initNum + delta*i) + 'ps 0mv ')
s += (str(initNum + delta*i + 1) + 'ps 1.035mv ')
s += (str(initNum + delta*i + 2) + 'ps 1.035mv ')
@de1o
de1o / combination.py
Created June 18, 2012 16:33
combination_of_each_2_item_in_a_row_of_xls
from xlrd import open_workbook
from xlwt import Workbook
book = open_workbook('test.xls')
sheet = book.sheet_by_index(0)
ready_to_write = []
def proc(l):
for i in range(l.__len__()):
@de1o
de1o / 16input.py
Created November 19, 2012 04:44
input
#for changing the initial number by adjusting the votalge
import argparse
import re
import sys
parser = argparse.ArgumentParser()
parser.add_argument('-VB', dest='vb')
parser.add_argument('-IN', dest='initNum')
parser.add_argument('-DT', dest='delta')
parser.add_argument('-A', dest='a', default='1001011010111101') # pattern for input a, 1101 e.g.
@de1o
de1o / config.json
Created February 21, 2013 09:22
a pyscript used for auto executing a list of commands via telnet/ssh, auto anwser the commands' reply and logging the output where needed. using json to config the infomation of each command.
{
"normalExpect": {
"general": "\\$",
"root": "\\#"
},
"cmd": [
{
"cmd": "",
"expect": "login:\\s"
},
@de1o
de1o / Vs2010Tips.md
Last active December 14, 2015 08:19
some useful shortcuts in VS2010.
  • Ctrl Alt L 显示解决方案视图(物理文件)
  • Ctrl Backspace 删除到词头(类似Bash里的Ctrl W
  • Ctrl W 是选择当前词,当然然后可以直接修改
  • Alt M 类似Sublime Text 2 里的Ctrl P,跳跃到输入的方法处(限本文档
  • Ctrl K Ctrl K 标记书签
  • F2 跳转到下一处书签 Shift F2 跳转到上一处书签
  • Ctrl K Ctrl L 清除所有书签
  • Shift Del 删除整行
  • Ctrl J 列出类,结构成员
  • shift+alt+mouse 选择一个矩形区域进行列编辑。
@de1o
de1o / floatCompare.c
Last active December 14, 2015 08:19
examples: how to compare float number in Clang.
#include<stdio.h>
main()
{
float i=7, j=10, k=0.7;
const float EPSILON = 0.000000000000000001;
//const float EPSILON = 0.0000001;
float tmp = i/j;
@de1o
de1o / vi_skills_kg.md
Last active December 14, 2015 17:48
vi's skills in kindgarden level. Add these to your repertoire ASAP.
  • ctrl v(linux)/ctrl q(windows): enable visual block mode(column edit)

navigation

  • Enter/+: move to the first non-blank char of next line.
  • H: move to the first line of current screen.
  • L: move to the last line of current screen.
  • -: move to the first non-blank char of previous line.
  • ^: move to the first non-blank char of current line.
  • 0: move to the first char(blank char included) of current line.