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
#resolver: ghc-7.8.4 | |
resolver: ghc-7.10.2 | |
packages: | |
- '.' | |
extra-deps: | |
- SourceGraph-0.7.0.7 | |
- Graphalyze-0.14.1.1 |
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
hello | |
tab indent | |
space indent | |
tab indent with following space | |
space before tab | |
space at eol (trailing-space) | |
tab at eol (trailing-space) | |
blank at eof (also trailing-space) | |
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/sh | |
# add this file to your path so that you can run it as an git command via `git checkoutr xxx` | |
br=$1 | |
test -z $br || git checkout $br | |
git submodule update --init --recursive |
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
ffmpeg -loglevel panic -f rawvideo -pix_fmt bgr32 -s 2560x1440 -i screenshot.raw -vcodec png -vframes 1 screenshot.png -y |
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
#coding:utf-8 | |
import subprocess | |
import time | |
from PIL import Image | |
def call(cmd): | |
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | |
return proc.stdout.read() | |
### general tools |
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
node --print "['吃', '矮', '笨', 'c', 'a', 'b'].sort((a, b) => a.localeCompare(b, 'zh-Hans-CN')).join('') === '矮笨吃abc'" | |
# Expected Output: true |
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
data Color = Red | Blue | |
data Size = S | M | L | |
data Ball : (c : Color) -> (s : Size) -> Type where | |
MkRedSBall : Ball Red S | |
MkRedMBall : Ball Red M | |
arr : List (c : Color ** s : Size ** Ball c s) | |
arr = [(Red ** S ** MkRedSBall), (Red ** M ** MkRedMBall)] |
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
; 搜狗输入法: 设置 -> 高级 -> 自定义短语设置 -> 直接编辑配置文件 | |
; 配置文件格式: <按键序列> "逗号" <位置> "等于号" <目标字符序列> | |
; 希腊字母: 参考 https://en.wikipedia.org/wiki/Greek_alphabet | |
Alpha,1=Α | |
alpha,1=α | |
Nu,9=Ν | |
nu,9=ν |
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
total = ['white', 'yellow', 'blue', 'purple', 'black'].map((x, i) => $('.kata .is-' + x + '-rank').length *2*(4**i)).reduce((x, y) => x+y) | |
count = ['white', 'yellow', 'blue', 'purple', 'black'].map((x) => $('.kata .is-' + x + '-rank').length) | |
//visit https://www.codewars.com/users/USERNAME/completed , and scroll to bottom of the page, and run above code in console. |
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
import Data.List | |
import GHC.Exts | |
type Number = Int | |
data Op = Add | Sub | Mul | Div | Pow deriving (Show, Eq, Ord, Enum, Bounded) | |
data AST = BinOp Op AST AST | Lit [Number] deriving (Eq, Ord) | |
instance Show AST where | |
show (BinOp op x y) = "(" ++ show x ++ pure ("+-*/^" !! fromEnum op) ++ show y ++ ")" |