Skip to content

Instantly share code, notes, and snippets.

I may be slow to respond.

雨神姥爷 rainyear

I may be slow to respond.
Block or report user

Report or block rainyear

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
rainyear / .tmux.conf
Created Sep 26, 2019 — forked from tsl0922/.tmux.conf
vim style tmux config
View .tmux.conf
# 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

Keybase proof

I hereby claim:

  • I am rainyear on github.
  • I am yusheng ( on keybase.
  • I have a public key ASAkSGe1LXL2CRP8ZzWxzmwzsRxTuUQZwhgZlHaxAZqg9Ao

To claim this, I am signing this object:

rainyear / hammerspoon.init.lua
Last active Mar 7, 2017
View hammerspoon.init.lua
local hyper = {'shift', 'cmd'}
local hyper2 = {'ctrl', 'cmd'}
-- hyper + up maximize the current window
hs.hotkey.bind(hyper, 'up', function()
hs.hotkey.bind(hyper, "Left", function()
local win = hs.window.focusedWindow()
local f = win:frame()
rainyear / ghost_foot.html
Last active Nov 15, 2015 is using ghost, {{ghost_foot}} injection was used to append donate button to every article.
View ghost_foot.html
<script type='tmpl' class='donation'>
<code class="language-javascript">
rainyear / Hspell.hs
Last active Nov 7, 2015
Spell corrector
View Hspell.hs
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
rainyear / miller-rabin.scm
Last active Nov 17, 2017
Miller-Rabin & RSA in Scheme.
View miller-rabin.scm
; Source codes of blog post: ;
; ;
; 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
################ Symbol, Procedure, classes
from __future__ import division
import re, sys, StringIO
class Symbol(str): pass
rainyear /
Created Jul 3, 2015
Hand posture detection with OpenCV.
#!/usr/bin/env python
import cv2
import numpy as np
def main():
cap = cv2.VideoCapture(0)
ret, img =
skinMask = HSVBin(img)
rainyear / ang2pix.js
Last active Aug 29, 2015
Visual Angle.
View ang2pix.js
// 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);
rainyear / cropBottomByX.m
Last active Aug 29, 2015
processing all jpg images from path <src> , crop <x> pixels from bottom, save to <dest>.
View cropBottomByX.m
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]);
You can’t perform that action at this time.