Skip to content

Instantly share code, notes, and snippets.

View hailinzeng's full-sized avatar
🏠
Working from home

Hailin, Zeng hailinzeng

🏠
Working from home
  • Beijing, China
View GitHub Profile
@hailinzeng
hailinzeng / git.sh
Created December 21, 2015 14:42 — forked from rochacbruno/git.sh
Um git.sh que funciona
#!/bin/bash
#-------------------------------------------------------------------------------
# Wrapper script that can specify an ssh-key file with the Git command
#
# The MIT License (MIT) - http://opensource.org/licenses/MIT
# Copyright (c) 2013 Alvin Abad
#-------------------------------------------------------------------------------
if [ $# -eq 0 ]; then
#!/usr/bin/env ruby
#
## Brute code stolen form: https://gist.github.com/petehamilton/4755855
#
@domain = 'contoso.com'
def result?(sub)
results = %x(dig +noall #{sub}.#{@domain} +answer)
@hailinzeng
hailinzeng / jthread.sh
Last active December 29, 2015 10:09
watch jvm process thread count
#!/bin/bash
while true; do pstree | grep "|-java" | awk -F* '{print $1}' | sed -e 's/|-java---//g' | sed -e 's/ //g' | tr "\\n" ","; date +"%D %T"; sleep 10; done
@hailinzeng
hailinzeng / url-hex-decode
Created November 8, 2013 09:18
replace hex string in url with char
// replace hex string in url with char, replace %2F with /
url = "http://www.58.com%2Fserver%2Fserver.xml";
url.replace(/%([0-9A-Fa-f]{2})/g, function() {
return String.fromCharCode(parseInt(arguments[1], 16));
});
@hailinzeng
hailinzeng / no_main.c
Created November 4, 2013 06:56
program without main
// gcc -o no_main no_main.c -nostartfiles
#include <stdio.h>
extern void _exit (register int code);
_start()
{
int retval;
retval = my_main ();
import os
import time
document = open("My Clippings.txt","r")
data = "".join(document.readlines())
notes = []
try:
clippings = data.split('==========')
for clip in clippings:
@hailinzeng
hailinzeng / htonll.c
Last active October 6, 2018 04:21
convert host order uint64_t to network order uint64_t
#include <sys/param.h>
uint64_t htonll(uint64_t n)
{
#if __BYTE_ORDER == __BIG_ENDIAN
return n;
#else
return (((uint64_t)htonl(n)) << 32) + htonl(n >> 32);
#endif
}
@hailinzeng
hailinzeng / split.lua
Created April 15, 2013 08:28
string split
function split(str,delim)
local i,j,k
local t = {}
k = 1
while true do
i,j = string.find(str,delim,k)
if i == nil then
table.insert(t,string.sub(str,k))
return t
end
## Major bug fix updates produced after the final release of the
## distribution.
deb http://old-releases.ubuntu.com/ubuntu/ maverick main restricted
deb-src http://old-releases.ubuntu.com/ubuntu/ maverick main restricted
deb http://old-releases.ubuntu.com/ubuntu/ maverick-updates main restricted
deb-src http://old-releases.ubuntu.com/ubuntu/ maverick-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://old-releases.ubuntu.com/ubuntu/ maverick universe