I hereby claim:
- I am rainyear on github.
- I am yusheng (https://keybase.io/yusheng) on keybase.
- I have a public key ASAkSGe1LXL2CRP8ZzWxzmwzsRxTuUQZwhgZlHaxAZqg9Ao
To claim this, I am signing this object:
# use C-a, since it's on the home row and easier to hit than C-b | |
set-option -g prefix C-a | |
unbind-key C-a | |
bind-key C-a send-prefix | |
set -g base-index 1 | |
# Easy config reload | |
bind-key R source-file ~/.tmux.conf \; display-message "tmux.conf reloaded." | |
# vi is good |
I hereby claim:
To claim this, I am signing this object:
local hyper = {'shift', 'cmd'} | |
local hyper2 = {'ctrl', 'cmd'} | |
-- hyper + up maximize the current window | |
hs.hotkey.bind(hyper, 'up', function() | |
hs.grid.maximizeWindow() | |
end) | |
hs.hotkey.bind(hyper, "Left", function() | |
local win = hs.window.focusedWindow() | |
local f = win:frame() |
<script type='tmpl' class='donation'> | |
<pre> | |
<code class="language-javascript"> | |
if(post.content.isHelpful){ | |
$("button#donate").click(); | |
}; | |
</code> | |
</pre> | |
<button | |
type="button" |
import Data.Char (toLower) | |
import qualified Data.Map as Map -- (insertWith, empty, member) | |
import qualified Data.Set as Set -- (fromList, toList, union, unions) | |
main :: IO () | |
main = do | |
fileStr <- readFile "big.txt" | |
let training = words $ toLower <$> fileStr | |
let knowledge = foldl (\m word -> Map.insertWith (+) word 1 m) Map.empty training |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; Source codes of blog post: ; | |
; http://blog.rainy.im/2015/08/27/miller-rabin-rsa/ ; | |
; Scheme runtime: Calysto Scheme ; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; math procedures | |
(define (square x) (* x x)) | |
(define (even? x) (= (remainder x 2) 0)) |
################ Scheme Interpreter in Python | |
## (c) Peter Norvig, 2010; See http://norvig.com/lispy2.html | |
################ Symbol, Procedure, classes | |
from __future__ import division | |
import re, sys, StringIO | |
class Symbol(str): pass |
#!/usr/bin/env python | |
import cv2 | |
import numpy as np | |
def main(): | |
cap = cv2.VideoCapture(0) | |
while(cap.isOpened()): | |
ret, img = cap.read() | |
skinMask = HSVBin(img) |
// cal Pix size with given visual angle and screen info. | |
var scr = { | |
xpixels: 1024, | |
ypixels: 768, | |
width: 360, //mm | |
height: 270, //mm | |
} | |
var ang2pix = function(screen, angle, distense){ | |
var targetWidth = angle.h * distense / (180 / 3.14); |
function cropBottomByX(src, dest, x) | |
srcImgs = [dir([src filesep '*.jpg'])]; | |
for i = 1:length(srcImgs) | |
imgLocation = [src filesep srcImgs(i).name]; | |
img = imread(imgLocation); | |
[h, w, d] = size(img); | |
disp(sprintf('Resizing image %s from %d to %d ...\n', srcImgs(i).name, h, h-x)); | |
img2 = img(1:h-x, :, :); | |
imwrite(img2, [dest filesep srcImgs(i).name]); |