This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import click | |
@click.group() | |
def main(): | |
""" | |
simple command manage tool | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"sync" | |
"time" | |
) | |
type TimeoutSet struct { | |
sync.RWMutex | |
time map[string]time.Time |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Package leakybuf provides leaky buffer. | |
// It's based on the example in Effective Go. | |
package leakybuf | |
type LeakyBuf struct { | |
bufSize int // size of each buffer | |
freeList chan []byte | |
} | |
// NewLeakyBuf creates a leaky buffer which can hold at most n buffer, each |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Usage: | |
# bash <(curl -s https://raw.githubusercontent.com/mixool/script/debian-9/subssr.sh) | |
# wget --no-check-certificate https://raw.githubusercontent.com/mixool/script/debian-9/subssr.sh && chmod +x subssr.sh && bash subssr.sh | |
declare -A my_ss_dic | |
declare -A my_ssr_dic | |
declare -A my_sub_dic | |
######################################################## EDIT BELOW ######################################################## |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
// This logging trick is learnt from a post by Rob Pike | |
// https://groups.google.com/d/msg/golang-nuts/gU7oQGoCkmg/j3nNxuS2O_sJ | |
import ( | |
"flag" | |
"fmt" | |
"io" | |
"log" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"os/exec" | |
"runtime" | |
"strings" | |
"github.com/axgle/mahonia" | |
) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"path/filepath" | |
"fmt" | |
"os" | |
"strings" | |
"log" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"fmt" | |
"go.etcd.io/etcd/clientv3" | |
"time" | |
) | |
func main() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"net" | |
"fmt" | |
) | |
func GetLocalIP() (ipv4 string, err error) { | |
var ( | |
addrs []net.Addr |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask_wtf import FlaskForm | |
class MyFlaskForm(FlaskForm): | |
class Meta(FlaskForm.Meta): | |
def get_translations(self, form): | |
return get_translations(["zh", "en"]) | |
def fetch_an_error(self): | |
message = "" | |
for _, messages in self.errors.iteritems(): |