Skip to content

Instantly share code, notes, and snippets.

Damon Zhao se77en

Block or report user

Report or block se77en

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View livecaption.go
// Copyright 2016 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
// Command caption reads an audio file and outputs the transcript for it.
package main
import (
"fmt"
"io"
View zhHans.conf.ini
# 你可以从该 URL 下载这个配置文件: http://surge.run/config-example/ios.conf
# 用编辑器编辑后,再通过 iTunes, URL, AirDrop 或者 iCloud Drive 复制回 iOS 设备
# Version 2.0
[General]
# 日志等级: warning, notify, info, verbose (默认值: notify)
loglevel = notify
# 跳过某个域名或者 IP 段,这些目标主机将不会由 Surge Proxy 处理。(在 macOS
# 版本中,如果启用了 Set as System Proxy, 那么这些值会被写入到系统网络代理
# 设置中.)
@Mudpuppy12
Mudpuppy12 / gist:db9f2a2b4ab62babd72a1edddd4b5273
Last active May 4, 2017
Example Iris Session / Basic Auth
View gist:db9f2a2b4ab62babd72a1edddd4b5273
// main.go
package main
import (
"time"
"github.com/kataras/iris"
"github.com/kataras/iris/config"
"github.com/kataras/iris/middleware/basicauth"
"github.com/kataras/iris/middleware/logger"
@turtlemonvh
turtlemonvh / Gin.WrapHH.go
Last active Jun 27, 2019
A pattern for wrapping functions that accept an http handler in gin
View Gin.WrapHH.go
// A wrapper that turns a http.ResponseWriter into a gin.ResponseWriter, given an existing gin.ResponseWriter
// Needed if the middleware you are using modifies the writer it passes downstream
// FIXME: Wrap more methods: https://golang.org/pkg/net/http/#ResponseWriter
type WrappedResponseWriter struct {
gin.ResponseWriter
writer http.ResponseWriter
}
func (w *WrappedResponseWriter) Write(data []byte) (int, error) {
return w.writer.Write(data)
@mrkaspa
mrkaspa / ifx.exs
Last active Jan 8, 2016
If else built in elixir using macros
View ifx.exs
defmodule My do
defmacro ifx(conds, [do: code1, else: code2]) do
quote do
case unquote conds do
true -> unquote code1
_ -> unquote code2
end
end
end
end
@aggrolite
aggrolite / redditbot.md
Last active Aug 13, 2019
Writing a reddit bot with Go and OAuth2
View redditbot.md
@ebuildy
ebuildy / docker-compose-sentry.yml
Created Nov 24, 2015
A simple docker-compose YML to run Sentry.
View docker-compose-sentry.yml
redis:
image: redis
postgres:
image: postgres:9.4
environment:
- POSTGRES_USER:sentry
- POSTGRES_PASSWORD:sentry
volumes:
- /var/data/sentry/postgre:/var/lib/postgresql/data:rw
@svett
svett / context.go
Created Nov 20, 2015
An example that illustrates how to work with https://godoc.org/golang.org/x/net/context
View context.go
package main
import (
"bufio"
"fmt"
"os"
"strings"
"time"
"golang.org/x/net/context"
@wintercn
wintercn / yc.js
Last active Apr 3, 2019
ycombinator in es2015
View yc.js
//yc here
var y = g =>
(f=>f(f))(
self =>
g( (...args)=>self(self)(...args) )
)
//use yc
var f = y(self =>
n => n < 0 ? 0 : n + self(n-1))
@ericlagergren
ericlagergren / index.gohtml
Last active Jul 2, 2018
Hot-reloading / hot-swapping live template files in Go
View index.gohtml
My name is {{.Name}} and I'm {{.Age}} years old!!
You can’t perform that action at this time.