Skip to content

Instantly share code, notes, and snippets.

Dolfly dolfly

Block or report user

Report or block dolfly

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 crf.py
#!/usr/bin/python
# crf.py (by Graham Neubig)
# This script trains conditional random fields (CRFs)
# stdin: A corpus of WORD_POS WORD_POS WORD_POS sentences
# stdout: Feature vectors for emission and transition properties
from collections import defaultdict
from math import log, exp
import sys
View HTML-tags.html
<!DOCTYPE html> <!-- HTML5 doctype 不区分大小写 -->
<html lang="zh-cmn-Hans-CN"> <!-- 更加标准的 lang 属性写法 http://zhi.hu/XyIa -->
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <!-- 优先使用IE最新版本和 Chrome -->
<!-- width=device-width 会导致 iPhone 5 添加到主屏后以 WebAPP 全屏模式打开页面时出现黑边 http://bigc.at/ios-webapp-viewport-meta.orz -->
<meta name ="viewport" content ="initial-scale=1.0, maximum-scale=3, minimum-scale=1, user-scalable=no">
@dolfly
dolfly / bucket_add.lua
Created Oct 19, 2018 — forked from florentchauveau/bucket_add.lua
Redis script (Lua) to add an event to a token bucket
View bucket_add.lua
-- Redis script to add an event to a token bucket
-- see https://medium.com/callr-techblog/rate-limiting-for-distributed-systems-with-redis-and-lua-eeea745cb260
-- (c) Florent CHAUVEAU <florent.chauveau@gmail.com>
local ts = tonumber(ARGV[1])
-- set the token bucket to 1 second (rolling)
local min = ts -1
-- iterate overs keys
View bucket_get.lua
-- Redis script to get the size of a token bucket
-- see https://medium.com/callr-techblog/rate-limiting-for-distributed-systems-with-redis-and-lua-eeea745cb260
-- (c) Florent CHAUVEAU <florent.chauveau@gmail.com>
local ts = tonumber(ARGV[1])
local key = KEYS[1]
-- remove tokens < min (older than now() -1s)
local min = ts -1
@dolfly
dolfly / leaky_bucket.lua
Created Oct 19, 2018 — forked from florentchauveau/leaky_bucket.lua
Redis script (Lua) to implement a leaky bucket
View leaky_bucket.lua
-- Redis script to implement a leaky bucket
-- see https://medium.com/callr-techblog/rate-limiting-for-distributed-systems-with-redis-and-lua-eeea745cb260
-- (c) Florent CHAUVEAU <florent.chauveau@gmail.com>
local ts = tonumber(ARGV[1])
local cps = tonumber(ARGV[2])
local key = KEYS[1]
-- remove tokens < min (older than now() -1s)
local min = ts -1
View gist:fd85ccd03427e52b9cc4a322d99f3bc1
### Keybase proof
I hereby claim:
* I am dolfly on github.
* I am dolfly (https://keybase.io/dolfly) on keybase.
* I have a public key ASAePSh2PbjI52HzTgmHU8Kv0OTqeU_1PwQYIn0tuyLeswo
To claim this, I am signing this object:
@dolfly
dolfly / macuser
Created Feb 19, 2019
Mac User Account Create & Delete
View macuser
mac user account create and delete
You can’t perform that action at this time.