This file contains 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
package main | |
import( | |
"syscall" | |
"fmt" | |
) | |
const( | |
//标准输出宏 | |
STD_OUTPUT_HANDLE = uint32(-11 & 0xFFFFFFFF) | |
) |
This file contains 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
package main | |
import ( | |
"fmt" | |
"log" | |
"os" | |
"os/exec" | |
"path/filepath" | |
"time" | |
) |
This file contains 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> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <unistd.h> | |
#include <arpa/inet.h> | |
#include <sys/types.h> | |
#include <netinet/in.h> | |
#include <sys/socket.h> | |
#define PORTNUM 2343 |
This file contains 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
go get | |
touch coverage.out | |
go test -coverprofile=coverage.out | |
go tool cover -html=coverage.out |
This file contains 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
#神依赖 | |
alias gg="git log --graph --color --decorate --stat" | |
alias gs="git status --short" | |
function my_promot { | |
local __git_branch='`git branch 2> /dev/null | grep -e ^* | sed -E s/^\\\\\*\ \(.+\)$/git:\\\\\1\/`' | |
export PS1="\[\e[32;1m\](\[\e[37;1m\]\u\[\e[32;1m\])-(\[\e[37;1m\]\@\d\[\e[32;1m\])-(\[\e[37;1m\]\w\[\e[32;1m\])\n(\[\e[37;1m\]$__git_branch\[\e[32;1m\])->\[\e[0m\]" | |
} | |
my_promot |
This file contains 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
function get_git_branch() | |
{ | |
branch__= | |
git branch &> /dev/null | |
if [ $? -eq 0 ]; then | |
branch__=`git branch --no-color | sed -ne 's/^\* \(.*\)$/\1/1p' | tr a-z A-Z` | |
else | |
branch__="NORMAL" |
This file contains 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
get_git_branch(){ | |
local branch | |
if branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null); then | |
printf '%s\n' "${branch^^}" # if on bash 3.2, you may need to use tr instead | |
else | |
echo "NORMAL" | |
fi | |
} |
This file contains 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
package main | |
import ( | |
"go/ast" | |
"go/parser" | |
"go/token" | |
"strconv" | |
) | |
// 实现一个只支持int,只支持加法,函数只有println,只支持一个参数的Go语言子集.... |
This file contains 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
set tabstop=8 | |
set softtabstop=8 | |
set shiftwidth=8 | |
set noexpandtab | |
set t_Co=256 | |
set nocompatible " be iMproved, required | |
filetype off " required | |
syntax enable | |
syntax on |
This file contains 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/sh | |
# set -x | |
# set -e | |
paths=$(find $GOROOT/src -type d | sed '1d' | sed "s|$GOROOT/src/||" | grep -v "^vendor" | grep -v "^cmd" | grep -v "builtin" | tr '\n' ' ') | |
paths_contains_go_source="" | |
cd $GOROOT/src | |
for path in $paths | |
do | |
if ls $path/*.go 1> /dev/null 2>&1; then | |
paths_contains_go_source+="\t\"$path\",\n" |
OlderNewer