Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am gamexg on github.
  • I am gamexg (https://keybase.io/gamexg) on keybase.
  • I have a public key ASBEgs4ActzVpY7JYFzDmPXm9jk8MQbHQY3Q_1PZ3abatAo

To claim this, I am signing this object:

@GameXG
GameXG / icmp
Created January 4, 2019 10:37 — forked from Kratos1918/icmp
package main
import (
"encoding/hex"
"fmt"
"golang.org/x/net/icmp"
"golang.org/x/net/ipv4"
"log"
"net"
"os"
@GameXG
GameXG / a.py
Last active June 23, 2017 12:09
# 实际执行任务的进程是 multiprocessing.Process 启动的,主进程会等待子进程结束并检查 exitcode 0.
# 另外如果多次任务执行失败会重启操作系统。
# 实际用法:
# with TaskHeartbeat(host_id, secret_key, task['id'], task['timeout']):
# 实际任务
class TaskHeartbeat(threading.Thread):
def __init__(self, host_id, secret_key, task_id, timeout):
def w(a = 234):
if callable(a):
# 目的是当用户 @w 时也有效。
return w()(a)
def ww(func):
@wraps(func)
def fffff( *args, **kwargs):
print (a)
return func(*args, **kwargs)
from functools import wraps
def logged(func):
@wraps(func) # 复制原始函数的名称、文档等内容到新函数。
def with_logging(*args, **kwargs):
print (func.__name__ + " was called")
return func(*args, **kwargs)
return with_logging
@logged
@GameXG
GameXG / init.lua
Last active June 29, 2019 15:25
4线风扇温度调速+WEB显示
-- https://www.chenwang.net/2016/11/07/4%e7%ba%bf%e9%a3%8e%e6%89%87%e6%b8%a9%e5%ba%a6%e8%b0%83%e9%80%9fweb%e6%98%be%e7%a4%ba/
-- D6 接 ds18b20 中 左为地 右VCC
-- D7 接风扇调速(蓝线(最边上))。 4线风扇依次为:地、VCC、测速(1圈2方波)、PWN调速
ds18b20=require("ds18b20")
ds18b20.setup(6)
pwm.setup(7, 1000, 512)
pwm.start(7)
package main
import (
"flag"
"sync"
"github.com/gamexg/proxyclient"
"net/url"
"sync/atomic"
"time"
"net/http"
// type4
package main
import (
"fmt"
)
type T1 int
type I1 interface {
F1()
}
func (t *T1) F1() {
// test_slice.go
package main
import (
"fmt"
)
func main() {
a := make([]byte, 0, 5)
a = append(a, 1)
@GameXG
GameXG / 1.py
Last active October 2, 2015 06:05
import re
import requests
import time
uname = 'test'
def k():
s = requests.session()
r=s.get('http://apple.cargomart.cn/index.php?m=Index&a=go&id=34081&from=groupmessage&isappinstalled=0')
a,b,fromhash =re.findall(u'(\d+)\+(\d+)=.+?<input type="hidden" name="formhash" value="(.+?)">',r.content,re.S)[0]