Skip to content

Instantly share code, notes, and snippets.

@mike-zhang
mike-zhang / getSoFuncsCommon.py
Created June 27, 2016 03:11
compare linux so files funcs
#! /usr/bin/env python
# -*-coding:utf-8 -*-
"""
compare so files funcs
test pass : centos6.4_x64
e-mail : mike_zhang@live.com
"""
import os
#!/bin/bash
#
# chkconfig: 23 90 10
# Description: Quickly hacked together bigcouch init script for CentOS systems.
. /etc/init.d/functions
PID_FILE=/var/run/bigcouch.pid
BIGCOUCH_BIN=/opt/bigcouch/bin/bigcouch
SUBSYS_LOCK_FILE=/var/lock/subsys/bigcouch
#!/usr/bin/env python
import paramiko
hostname = '192.168.1.1'
port = 22
username = 'foo'
password = 'xxxYYYxxx'
if __name__ == "__main__":
@mike-zhang
mike-zhang / gitReposMerge.py
Created May 17, 2013 09:21
合并两个git仓库
#! /usr/bin/python
import os
dir1 = "essays"
dir2 = "../tmp"
tmpBranchName = "other"
execCommand = os.system
#!/usr/bin/env python
# coding: utf-8
# http://musta.sh/2012-03-04/twisted-tcp-proxy.html
import sys
from twisted.internet import defer
from twisted.internet import protocol
from twisted.internet import reactor
from twisted.python import log
@mike-zhang
mike-zhang / vboxShell
Created December 11, 2012 03:26
实现vBox虚拟机启动和休眠
启动:
VBoxManage startvm CentOS6.3_64 -type vrdp
vbs代码:
Set ws = CreateObject("Wscript.Shell")
ws.run "cmd /c VBoxManage startvm CentOS6.3_64 -type vrdp",vbhide
休眠:
VBoxManage controlvm CentOS6.3_64 savestate
@mike-zhang
mike-zhang / getMACAddress_win.py
Created December 8, 2012 12:56
windows下获取MAC地址(python代码)
# just in windows
import os
var = os.popen("wmic nicconfig get MACAddress").read()
#print var
macList = []
for x in var.split(" \r\n"):
if len(x.strip()) > 0 and x.find("MACAddress"):
if x not in macList:macList.append(x)
@mike-zhang
mike-zhang / extensions.lua
Created December 7, 2012 07:36 — forked from igmar/extensions.lua
Asterisk LUA dialplan
require("lsqlite3")
-- Igmar: Wanneer closen we dat DB object eigenlijk ?
db = sqlite3.open('/etc/asterisk/users.sqlite')
--CONSOLE = "Console/dsp" -- Console interface for demo
--CONSOLE = "DAHDI/1"
--CONSOLE = "Phone/phone0"
TRUNK = "DAHDI/G1"
@mike-zhang
mike-zhang / git_Backup.py
Created November 29, 2012 01:40
git备份程序
import os
'''
.ssh/config (windows,for local git server):
Host host100
Hostname 192.168.1.100
User git
IdentityFile C:/Users/admin/.ssh/id_rsa_gitBackup_host100
repo example:
@mike-zhang
mike-zhang / build.py
Created November 17, 2012 06:03
py2exe简单示例
'''
fileName : build.py
usage : build.py py2exe
'''
from distutils.core import setup
import py2exe
import sys
includes = ["encodings", "encodings.*"]
sys.argv.append("py2exe")