Skip to content

Instantly share code, notes, and snippets.

View fengxsong's full-sized avatar
🤓

fengxsong fengxsong

🤓
  • Guangzhou,China
  • 01:14 (UTC +08:00)
View GitHub Profile
#!/usr/bin/env python
import os
BASEDIR = os.path.dirname(os.path.abspath(__file__))
filenames = [f for f in os.listdir(BASEDIR) if os.path.splitext(f)[1] == '.txt']
for filename in filenames:
fn, ext = os.path.splitext(filename)
@fengxsong
fengxsong / read_file.go
Created September 19, 2016 09:07
count the number of rows in a file
package main
import (
"bufio"
"fmt"
//"bytes"
"flag"
"os"
//"io"
//"io/ioutil"
@fengxsong
fengxsong / randMoney.go
Created September 24, 2016 01:35
将total块钱随机分给num个人,最大值maxVal,最小值minVal。float64的精度问题?
package main
import (
"fmt"
"math/rand"
"strconv"
"time"
)
type RandMoney struct {
@fengxsong
fengxsong / chat.go
Created October 3, 2016 03:18
chat server or client.
package main
import (
"bufio"
"bytes"
"flag"
"fmt"
"log"
"net"
"os"
@fengxsong
fengxsong / sshd.go
Created October 13, 2016 09:13
sshd proxy...
package main
import (
"errors"
"flag"
"fmt"
"io"
"log"
"net"
"strings"
@fengxsong
fengxsong / check_http.go
Last active November 23, 2017 04:53
check_http tracing http request. notice! some function comes from davecheney's httpstat
package main
import (
"bytes"
"context"
"crypto/tls"
"encoding/base64"
"encoding/json"
"encoding/pem"
"flag"
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import os
import click
import logging
import re
import subprocess
import time
@fengxsong
fengxsong / OID.md
Created May 23, 2017 03:05
snmp oid
OID Descr Remarks Method
.1.3.6.1.2.1.1.1.0 系统基本信息 SysDescr GET
.1.3.6.1.2.1.1.3.0 SNMP自启动监控时间 sysUptime GET
.1.3.6.1.2.1.1.4.0 系统联系人 sysContact GET
.1.3.6.1.2.1.1.5.0 机器名 SysName GET
.1.3.6.1.2.1.1.6.0 所在位置 SysLocation GET
.1.3.6.1.2.1.1.7.0 提供服务 SysService GET
.1.3.6.1.2.1.25.4.2.1.2 系统运行进程列表 hrSWRunName WALK
.1.3.6.1.2.1.25.6.3.1.2 系统安装列表 hrSWInstalledName WALK
@fengxsong
fengxsong / difference-between-some-operators-golang.md
Last active May 23, 2017 03:07
difference-between-some-operators-golang

[URL][1]

package main

import "fmt"

func main() {
    // Use bitwise OR | to get the bits that are in 1 OR 2
    // 1     = 00000001

// 2 = 00000010

@fengxsong
fengxsong / auto_reg.go
Last active July 2, 2017 06:56
test github.com/weibocom/nginx-upsync-module
package main
import (
"bytes"
"flag"
"fmt"
"io"
"io/ioutil"
"net"
"net/http"