Skip to content

Instantly share code, notes, and snippets.

View ma6174's full-sized avatar
🤣
/

ma6174 ma6174

🤣
/
View GitHub Profile
@ma6174
ma6174 / gist:10094894
Created April 8, 2014 05:43
mongo bson
var allItems = []testItemType{
{bson.M{},
""},
{bson.M{"_": float64(5.05)},
"\x01_\x00333333\x14@"},
{bson.M{"_": "yo"},
"\x02_\x00\x03\x00\x00\x00yo\x00"},
{bson.M{"_": bson.M{"a": true}},
"\x03_\x00\x09\x00\x00\x00\x08a\x00\x01\x00"},
{bson.M{"_": []interface{}{true, false}},
@ma6174
ma6174 / 0_reuse_code.js
Created May 11, 2014 03:51
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@ma6174
ma6174 / gist:66c8d5c39ba1369da1f6
Created June 2, 2014 14:37
修复acer笔记本ubuntu14.04开机和休眠唤醒后wifi无法自动打开问题
echo "blacklist acer_wmi" | sudo tee -a /etc/modprobe.d/blacklist.conf
@ma6174
ma6174 / byobu.md
Created June 3, 2014 13:19
byobu快捷键

可以使用byobu代替screen,配合tmux使用

F2 创建新的窗口
shift+F2生成水平分隔
ctrl+F2生成垂直分隔
ctrl+shift+F2生成新会话
F3 回到先前窗口
F4:跳到下一个窗口
shift+F3在一个窗口的分隔中回到上一个子窗口,可循环
@ma6174
ma6174 / code.go
Last active August 29, 2015 14:06
code server
package main
import (
"flag"
"log"
"strconv"
"net/http"
)
var code = flag.Int("c", 200, "code")
@ma6174
ma6174 / walk.go
Created March 9, 2015 19:22
walk
package main
import (
"fmt"
"log"
"os"
"path/filepath"
"sort"
"strings"
)
@ma6174
ma6174 / sort.go
Created May 11, 2015 15:19
golang map vs slice sort speed
package main
import (
"fmt"
"math/rand"
"sort"
"time"
)
type S []int
package main
import (
"flag"
"fmt"
"log"
"strconv"
)
func main() {
@ma6174
ma6174 / copy.sh
Created September 5, 2015 14:15
run a command and copy result to clipboard, or copy data from stdin.
#!/bin/bash
if [ $# -gt 0 ]; then
(echo "$ "$@ && exec $@) | tee /dev/fd/2 | pbcopy
else
tee /dev/fd/2 | perl -pe 'chomp if eof' | pbcopy
fi
@ma6174
ma6174 / container_init.sh
Created September 6, 2015 13:18
docker container init script
#!/bin/bash
export LC_ALL=C
sed -i 's|archive.ubuntu.com|mirrors.ustc.edu.cn|g' /etc/apt/sources.list
apt-get update
apt-get install -y tmux netcat iputils-ping curl dstat lsof mtr tcpdump axel