Skip to content

Instantly share code, notes, and snippets.

@mike-zhang
mike-zhang / getSoFuncsCommon.py
Created Jun 27, 2016
compare linux so files funcs
View getSoFuncsCommon.py
#! /usr/bin/env python
# -*-coding:utf-8 -*-
"""
compare so files funcs
test pass : centos6.4_x64
e-mail : mike_zhang@live.com
"""
import os
View gist:1a35b380bac510ad8795
#!/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
View ssh_client.py
#!/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
合并两个git仓库
View gitReposMerge.py
#! /usr/bin/python
import os
dir1 = "essays"
dir2 = "../tmp"
tmpBranchName = "other"
execCommand = os.system
View tcp-proxy.py
#!/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 Dec 11, 2012
实现vBox虚拟机启动和休眠
View vboxShell
启动:
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 Dec 8, 2012
windows下获取MAC地址(python代码)
View getMACAddress_win.py
# 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 Dec 7, 2012 — forked from igmar/extensions.lua
Asterisk LUA dialplan
View extensions.lua
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"
View git_Backup.py
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 Nov 17, 2012
py2exe简单示例
View build.py
'''
fileName : build.py
usage : build.py py2exe
'''
from distutils.core import setup
import py2exe
import sys
includes = ["encodings", "encodings.*"]
sys.argv.append("py2exe")