Skip to content

Instantly share code, notes, and snippets.

View henryscala's full-sized avatar

henryscala henryscala

  • China
View GitHub Profile
@henryscala
henryscala / goserver.go
Created January 26, 2016 15:04
A simple http server implemented in golang, can be used to serve static contents in a directory.
package main
import (
"flag"
"fmt"
"net/http"
)
const ()
@henryscala
henryscala / iBash_setup.md
Last active December 14, 2015 04:19
install virtual BOX, CentOS, Anaconda, iBash

This article describes my steps to setup the iBash environment in my Windows 7 OS.

install virtual box

create a VM and install CentOS

  • While installing, just select Linux, instead of Redhat
  • Rember to select Desktop CentOS in one of the step, instead of using the default minimal CentOS, to use the GUI
  • Install Enhance functions to the VM(Just click the menu item of the virtual box)
  • Enable bi-directionaly Clipboard between VM and the Host OS.
  • Specify a Share Folder to transfer to/from CentOS
@henryscala
henryscala / wireshark_SIP.py
Created November 24, 2015 05:01
ONE-OFF script to split SIP messages captured via wireshark, and group the messages by call-id.
import re
import collections
from collections import defaultdict
from collections import namedtuple
fileName='all-packet.txt'
fileNameOut = fileName+"out.txt"
file = open(fileName)
@henryscala
henryscala / findroot.py
Created November 6, 2015 09:43
using sympy to solve(approximate) numeric equations's root (it uses bi-sect method)
In [9]: import sympy
In [11]: from sympy import symbols
In [12]: x = symbols('x')
In [13]: x
Out[13]: x
@henryscala
henryscala / MSC.R
Created October 30, 2015 02:29
Inner DSL of R to generate MSC
# A R program to help generate MSC charts.
# The feature to differentiate it from other similar tools is that it support parallel messages.
# It is in testing phase.
library("grid")
diagram.params <- list(titleLines=1,
headLines=2,
widthPad=1,
heightPad=0.5,
@henryscala
henryscala / main.go
Created May 28, 2015 06:33
using svgo to draw a logo in SVG format
package main
import (
"github.com/ajstarks/svgo"
"os"
"fmt"
)
/*width 50, height 50*/
func drawHeart(canvas *svg.SVG, x, y int ) {
@henryscala
henryscala / vbafunc.bas
Created November 27, 2014 01:53
vba functions
Sub squeezeRow(column, startRow, endRow As Integer)
Dim count As Integer
count = 0
i = startRow
Do While i <= endRow
If Cells(i, column).Value = "" Then
For j = i + 1 To endRow
Cells(j - 1, column).Value = Cells(j, column).Value
Next
Cells(endRow, column) = ""
@henryscala
henryscala / worker.py
Created November 24, 2014 05:57
python script for changing line in a file in patch way
srcFileName = r'file1.java'
dstFileName = r'file2.java'
srcFile = open(srcFileName,'r')
dstFile = open(dstFileName,'w')
def listToStr(alist):
result ='';
for a in alist:
@henryscala
henryscala / my program of haskell for an online course
Created November 12, 2014 05:36
Lab2 -- my program of haskell for an online course
module Lab2 where
------------------------------------------------------------------------------------------------------------------------------
-- Lab 2: Validating Credit Card Numbers
------------------------------------------------------------------------------------------------------------------------------
-- ===================================
-- Ex. 0
-- ===================================