Skip to content

Instantly share code, notes, and snippets.

@snail007
snail007 / Redis分布锁PHP实现.txt
Created March 29, 2018 08:20
Redis分布锁PHP实现
<?php
/**
* Redis分布锁实现
* @author pengmeng
* 实例:
* 初始化并配置锁
* $redis是连接redis之后的redis对象.
* $lock = new RedisLock($redis);
* $lock->setKeyPrefix('testLock:')->setRxpire(15);
@snail007
snail007 / gist:6c2ca18e165256f49c1ce80e9604fff4
Created March 22, 2018 10:23
安卓显示被隐藏的linux deploy桌面图标
From Android terminal:
am start -n ru.meefik.linuxdeploy/.MainActivity
or from inside Linux container:
unchroot su -c "am start -n ru.meefik.linuxdeploy/.MainActivity"
and unckeck this option.
@snail007
snail007 / 修改系统时区.txt
Created January 25, 2018 02:55
修改系统时区.txt
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
@snail007
snail007 / cgo.md
Created January 11, 2018 08:21 — forked from zchee/cgo.md
cgo convert list

See also, http://libraryofalexandria.io/cgo/

Using Go cgo

cgo has a lot of trap.
but Not "C" pkg also directory in $GOROOT/src. IDE's(vim) Goto command not works.

So, Here collect materials.

https://github.com/devlinkcn
@snail007
snail007 / blocked
Last active September 10, 2017 14:32
My cow direct & blocked file for g*f*w
0rz.tw
0to255.com
0zz0.com
1-apple.com.tw
1000dosok.ru
1000giri.net
1024.inc.gs
10conditionsoflove.com
10musume.com
10youtube.com
@snail007
snail007 / network-analysis.sh
Created August 30, 2017 08:00
网络分析shell脚本(实时流量+连接统计)
#!/bin/bash
#write by zhumaohai(admin#centos.bz)
#author blog: www.centos.bz
#显示菜单(单选)
display_menu(){
local soft=$1
local prompt="which ${soft} you'd select: "
@snail007
snail007 / client.go
Last active August 18, 2017 03:09 — forked from xjdrew/client.go
golang tls client and server, require and verify certificate in double direction,golang tls 双向验证
package main
import (
"crypto/tls"
"crypto/x509"
"flag"
"io"
"io/ioutil"
"log"
"os"
@snail007
snail007 / README.txt
Created August 6, 2017 12:49 — forked from ncw/README.txt
Client side certificates with go
This demonstrates how to make client side certificates with go
First generate the certificates with
./makecert.sh test@test.com
Run the server in one terminal
go run server.go
@snail007
snail007 / go_reflect_struct_interface.go
Last active June 29, 2022 11:03
动态创建任何struct类型的数组,并对结构体字段赋值。
package main
import "reflect"
import "fmt"
type User struct {
Name string
}
func main() {