Skip to content

Instantly share code, notes, and snippets.

@groundwalker
groundwalker / memcached_stats.go
Created January 14, 2016 14:43
get STATS of memcached
package main
import (
"fmt"
"net" // https://golang.org/pkg/net/
"bufio"
"regexp"
"strings"
"os"
)
@groundwalker
groundwalker / cmd.go
Last active January 22, 2016 14:24
Execute arbitrary commands by golang
package main
// execute arbitrary shell command
// if chmod u+s ./cmd, you can cross the bounds of shell scripts
import (
"os"
"os/exec"
"log"
)
#!/bin/sh
#prev_rev=$1
rev=`git rev-parse --short HEAD`
date=`date +%m/%d`
echo $date build $rev
echo
#git log | grep '^\(commit\| \)'| sed -n "1,/${prev_rev}/p"
@groundwalker
groundwalker / snmpwalk.go
Last active March 7, 2023 16:13
snmpwalk by golang!
package main
// usage: ./snmpwalk oid
//
// build: go build snmpwalk.go
//
// do like this
// snmpwalk -v 2c -c private 127.0.0.1 .1.3.6.1.4.1.2021.11
import (