Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
#usage: bash tag.sh [comment]
#This script will tag the current commit with the latest tag and increment the version
#increment the patch version if the patch version is greater than 9 increment the minor version and reset the patch version to 0
#increment the minor version if the minor version is greater than 9 increment the major version and reset the minor version to 0
#The tag will be in the format v0.0.0-000000000000 [major.minor.patch-date]
#The script will also push the tag to the remote repository
#The script will also tag the commit with the comment provided
if [ -z $1 ];then
echo "special comment please!"
abstract class StructMessage {
public void fromBytes(byte[] b) throws IllegalAccessException {
ByteBuffer bb = ByteBuffer.wrap(b);
for (Field field : this.getClass().getDeclaredFields()) {
field.setAccessible(true);
Class t = field.getType();
int size = 0;
if(t == String.class && field.getName().toLowerCase().equals("name")) {
size = 10;
} else if(
## Based on: http://code.activestate.com/recipes/577654/
#!/usr/bin/env python
# Send DDE Execute command to running program
from ctypes import POINTER, WINFUNCTYPE, c_char_p, c_void_p, c_int, c_ulong, c_char_p
from ctypes.wintypes import BOOL, DWORD, BYTE, INT, LPCWSTR, UINT, ULONG
import time
# DECLARE_HANDLE(name) typedef void *name;
HCONV = c_void_p # = DECLARE_HANDLE(HCONV)
@zhangjiayin
zhangjiayin / jsx-requirejs-babel.js
Created November 15, 2016 04:18
js requirejs babel in browser
define(function () {
'use strict';
var buildMap = {};
var transform = {
/**
* Reads the .jsx file synchronously and requires react-tools
* to perform the transform when compiling using r.js
<?xml version="1.0"?>
<!DOCTYPE tsung SYSTEM "/opt/local/share/tsung/tsung-1.0.dtd" []>
<tsung loglevel="notice" version="1.0" dumptraffic="true">
<!-- Each client that will be running Tsung during the test -->
<clients>
<client host="localhost" use_controller_vm="true" maxusers="100000" />
</clients>
<!-- Each remote server that Tsung should performance test against. Only one would be needed if you have a load balancer. -->
@zhangjiayin
zhangjiayin / nginx.conf
Last active August 29, 2015 14:24 — forked from jrom/nginx.conf
if ($request_uri = /) {
set $test A;
}
if ($host ~* teambox.com) {
set $test "${test}B";
}
if ($http_cookie !~* "auth_token") {
set $test "${test}C";
# Documentation for HAProxy
# http://code.google.com/p/haproxy-docs/w/list
# http://haproxy.1wt.eu/download/1.2/doc/architecture.txt
# NOTES:
# open files limits need to be > 256000, use ulimit -n to set (on most POSIX systems)
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice