Skip to content

Instantly share code, notes, and snippets.

View hustlijian's full-sized avatar
🎯
Focusing

Li Jian hustlijian

🎯
Focusing
View GitHub Profile
@hustlijian
hustlijian / Makefile
Created May 26, 2013 15:36
a lua c api sample
all:
gcc -o capi capi.c -llua5.1
clean:
rm -rvf capi
@hustlijian
hustlijian / wifi.bat
Last active December 21, 2015 17:18
this is a bat file used to setup WiFi hostednetwork, 自建wifi热点,使用脚本来设置、启动和关闭等。 来源:[随身WiFi](http://blog.idf.cn/archives/1400.html)
:begin
cls
@echo.※※※※※※※※※※※※※※※※※※※※※※※※※
@echo off
echo.
echo.欢迎使用win7双网卡WiFi开关
echo.
echo.※※※※※※※※※※※※※※※※※※※※※※※※※
echo.
@hustlijian
hustlijian / Makefile
Last active August 23, 2022 05:10
mmap ----------- a short demo for mmap in linux! 一个使用mmap实现进程间通信的例子。
all:
gcc -o master ./master.c
gcc -o slave ./slave.c
clean:
rm -f master slave
@hustlijian
hustlijian / Makefile
Created March 20, 2014 13:10
text query class of <c++ primer>: input a file, and query the word occur lines
CC = g++
CFLAGS = -g -Wall
DIR_BIN = .
INCS_HEAD := .
LIB_PATH := #-L /usr/lib
LIBS := #-lpthread
@hustlijian
hustlijian / Makefile
Created August 27, 2014 13:46
simple c++ makefile
CXXFLAGS=-Wall -g
CC=g++
LDFLAGS=-L/usr/lib
LDLIBS=-lm
all: main
main: main.o expression.o
clean:
@hustlijian
hustlijian / performance.py
Created February 4, 2015 05:23
linux 性能信息收集(阿里)(linux server performance info collect script)
#!/usr/bin/python
#
# site: http://outofmemory.cn/code-snippet/35902/python-collect-server-performance-info
# introduction: collect linux server performance info
#
#########################################
# Function: sample linux performance indices
# Usage: python sampler.py
# Author: CMS DEV TEAM
# Company: Aliyun Inc.
@hustlijian
hustlijian / latency.txt
Created September 16, 2017 03:36 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@hustlijian
hustlijian / monitor
Created June 4, 2018 08:33
monitor and restart
#!/bin/bash
# 重试运行的命令
echo $@
MAX_REBOOT_TIMES=100 # 最大重启次数
reboot_times=0
while true ; do
$@
// curl -X POST -H "Content-Type: application/octet-stream" --data-binary '@filename' http://127.0.0.1:5050/upload
// curl -F "[email protected]" http://127.0.0.1:5050/upload2
// go run main.go
package main
import (
"fmt"
"io"
"net/http"
"os"
@hustlijian
hustlijian / bash-parameter
Created March 23, 2019 08:49
bash handle input aprameter
while [ "$1" != "" ]; do
case $1 in
-s ) shift
SERVER=$1 ;;
-d ) shift
DATE=$1 ;;
--paramter|p ) shift
PARAMETER=$1;;
-h|help ) usage # function call
exit ;;