Skip to content

Instantly share code, notes, and snippets.

@cnsoft
cnsoft / RiakHttp10k.txt
Created June 27, 2012 15:39 — forked from toastdriven/RiakHttp10k.txt
Benching Riak's performance with the Python client.
[daniel@Europa:Desktop]: python riak_test.py
Inserting 0
Inserting 1000
Inserting 2000
Inserting 3000
Inserting 4000
Inserting 5000
Inserting 6000
Inserting 7000
Inserting 8000
@cnsoft
cnsoft / SXGauge.h
Created November 20, 2012 08:20 — forked from PrimaryFeather/SXGauge.h
This Sparrow extension class displays a texture, trimmed to its left side, depending on a ratio. This can be used to create a progress bar or a rest-time display.
#import <Foundation/Foundation.h>
#import "Sparrow.h"
/// An SXGauge displays a texture, trimmed to its left side, depending on a ratio.
/// This can be used to display a progress bar or a time gauge.
@interface SXGauge : SPSprite
{
@private
SPImage *mImage;
float mRatio;
@cnsoft
cnsoft / ClippedSprite.as
Created November 20, 2012 08:20 — forked from PrimaryFeather/ClippedSprite.as
Simple Sprite subclass with a rectangular mask in stage coordinates
package starling.extensions
{
import flash.display3D.Context3D;
import flash.geom.Point;
import flash.geom.Rectangle;
import starling.core.RenderSupport;
import starling.core.Starling;
import starling.display.DisplayObject;
import starling.display.Sprite;
From: http://snipt.net/yonishin/about-xcode-4-project-template
XCode 4 Projects and Files Template Folder: /Developer/Library/Xcode/Templates
Examples:
/Developer/Library/Xcode/Templates/Project Templates/Base/Other/Empty.xctemplate
/Developer/Library/Xcode/Templates/Project Templates/Base/Base.xctemplate
/Developer/Library/Xcode/Templates/Project Templates/Mac/Mac Base.xctemplate
/Developer/Library/Xcode/Templates/Project Templates/Mac/Application/Command Line Tool.xctemplate
/Developer/Library/Xcode/Templates/Project Templates/Mac/Application/Cocoa Application.xctemplate
@cnsoft
cnsoft / mox_demo1.py
Last active December 17, 2015 09:39
how to use pymox mock bigworld module
import mox
import stubout
#test function tearup
m = mox.Mox()
BigWorld = m.CreateMockAnything()
m.StubOutWithMock(BigWorld,"entities")
m.StubOutWithMock(BigWorld,"singleton")
#Great,prepare clientside input data for function be called.
BigWorld.entities.get(100).AndReturn(None)
#!/usr/bin/env python
import paramiko
hostname = 'localhost'
port = 22
username = 'foo'
password = 'xxxYYYxxx'
if __name__ == "__main__":
@cnsoft
cnsoft / Pexpect_demo2.py
Created May 17, 2013 03:56
I collect this examples. maybe you will need it soon.
#!/usr/bin/python
#
#Notice:Please close domain lookup on your router or switch.
__author__="ring0"
__date__ ="$2011-6-5 16:00:00$"
__version__ ="0.3"
import sys
try:
@cnsoft
cnsoft / Pexpect_demo3.py
Last active December 17, 2015 10:49
Auto Start or Shutdown Testing Server
child = pexpect.spawn('su 3028')
child.expect(".word")
child.sendline("3028")
child.expect(".$")
child.sendline('cd ~')
child.sendline('/home/exe/mf204/bigworld/tools/server/control_cluster.py check')
r = child.expect([".not run",".run",pexpect.EOF])
if r == 0:
child.sendline('/home/exe/mf204/bigworld/tools/server/control_cluster.py load simple')
print 'try load server'
import os
filters = ['.cpp','.h','.py','.hpp','.ipp','.sln','.vcproj','.mak']
filters.extend(['.c','python','Makefile','php'])
#filters = ['python']
#filters = ['*']
if os.name == 'posix':
FOLDER_FIX = '/'
else:
FOLDER_FIX = "\\"
@cnsoft
cnsoft / Demo_exportRev.py
Created May 24, 2013 09:48
export rev files only.. used to create hot fix..
#!/usr/bin/env python
#svn log -v -r 20146:20150 svn://192.168.1.230/tjspaces
#Author cnsoft 2011-09
svncmd = "svn log -v -r %d:%d %s"
#Test
svnurl = "svn://192.168.1.230/tjspaces/"
#
outputpath = "d:\\packagetools"