Skip to content

Instantly share code, notes, and snippets.

Avatar
😈
I may be slow to respond.

李亚夫 leyafo

😈
I may be slow to respond.
View GitHub Profile
@leyafo
leyafo / report_goroutine_progress.go
Last active May 22, 2019
Report mutiple go routine progress. If you wang report async goroutine schedule, you can use a channel to report the progress sequentially. Especilly if you want design a progressing bar.
View report_goroutine_progress.go
package main
import (
"fmt"
"sync"
"time"
)
func main() {
c := make(chan struct{})
@leyafo
leyafo / gen_models.go
Created Sep 7, 2017
generate go CRUD code by robots.
View gen_models.go
package main
import (
"fmt"
"os"
"path"
"text/template"
"github.com/jmoiron/sqlx"
_ "github.com/lib/pq"
@leyafo
leyafo / awesom-go count
Last active Nov 29, 2019
awesome-go count stars
View awesom-go count
Count By 2017-07-04
Repo Stars
https://github.com/kubernetes/kubernetes 24538
https://github.com/bayandin/awesome-awesomeness 19182
https://github.com/astaxie/build-web-application-with-golang 16645
https://github.com/coreos/etcd 13933
https://github.com/mholt/caddy 12840
https://github.com/astaxie/beego 11438
https://github.com/influxdb/influxdb 10952
https://github.com/github/hub 10903
@leyafo
leyafo / subtitles_parse.py
Created Jun 12, 2015
srt subtitles parse
View subtitles_parse.py
import os, sys;
import distutils.file_util as file_util
def iterate_path(source):
#list all files
files = os.listdir(source)
for f in files:
if(os.path.isfile(os.path.join(source,f))):
#check hide file
if(f[0] == "." or f == 'tmp.py'):
@leyafo
leyafo / time_ago_in_words
Last active Aug 9, 2017
A simple ruby time ago convert
View time_ago_in_words
MINUTE = 60
HOUR = MINUTE*60
DAY = HOUR*24
WEEK = DAY*7
MONTH = DAY*30
YEAR = MONTH*12
def time_ago_in_words(near_time, far_time)
diff = near_time.to_i - far_time.to_i
You can’t perform that action at this time.