Skip to content

Instantly share code, notes, and snippets.

View wweir's full-sized avatar
💯

wweir wweir

💯
View GitHub Profile
@wweir
wweir / god
Last active June 5, 2020 11:13
利用 goproxy 加速安装 gopls 之类命令行工具,并保持开发环境整洁
#!/usr/bin/env bash
god(){
mkdir -p /tmp/god
(cd /tmp/god && go mod init god &> /dev/null)
for repo in $@; do
(cd /tmp/god && GOPROXY=${GOPROXY:-https://goproxy.cn,direct} go get $repo)
done
}
god $@
@wweir
wweir / j2p
Last active September 20, 2022 07:17
json to protobuf definition transfer tool
#!/usr/bin/env php
<?php
$usage = "usage:\n\t" . $argv[0] . " <path_to_json_file>\n\t<pipe_json_string> | " . $argv[0] . " -\n";
function from_camel_case($input) {
preg_match_all('!([A-Z][A-Z0-9]*(?=$|[A-Z][a-z0-9])|[A-Za-z][a-z0-9]+)!', $input, $matches);
$ret = $matches[0];
foreach ($ret as &$match) {
$match = $match == strtoupper($match) ? strtolower($match) : lcfirst($match);
}
@wweir
wweir / dhcp.go
Created March 15, 2019 03:42
dhcp by pcap
package dhcp
import (
"io"
"math/rand"
"net"
"time"
"github.com/golang/glog"
"github.com/google/gopacket"