This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> //printf | |
#include <string.h> //strncpy | |
#include <sys/socket.h> | |
#include <sys/ioctl.h> | |
#include <net/if.h> //ifreq | |
#include <unistd.h> //close | |
int main() | |
{ | |
int fd; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
### | |
### my-script — does one thing well | |
### | |
### Usage: | |
### my-script <input> <output> | |
### | |
### Options: | |
### <input> Input file to read. | |
### <output> Output file to write. Use '-' for stdout. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def FindCorrespondingSourceFile( filename ): | |
if IsHeaderFile( filename ): | |
basename = os.path.splitext( filename )[ 0 ] | |
for extension in SOURCE_EXTENSIONS: | |
replacement_file = basename + extension | |
if os.path.exists( replacement_file ): | |
return replacement_file | |
name = os.path.basename(replacement_file) | |
upper_file = os.path.normpath(os.path.join(os.path.dirname(replacement_file), "../", name)) | |
if os.path.exists( upper_file): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ;; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# 重试运行的命令 | |
echo $@ | |
MAX_REBOOT_TIMES=100 # 最大重启次数 | |
reboot_times=0 | |
while true ; do | |
$@ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CXXFLAGS=-Wall -g | |
CC=g++ | |
LDFLAGS=-L/usr/lib | |
LDLIBS=-lm | |
all: main | |
main: main.o expression.o | |
clean: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CC = g++ | |
CFLAGS = -g -Wall | |
DIR_BIN = . | |
INCS_HEAD := . | |
LIB_PATH := #-L /usr/lib | |
LIBS := #-lpthread |
NewerOlder