Skip to content

Instantly share code, notes, and snippets.

Avatar

Zeyi (Rice) Fan fanzeyi

View GitHub Profile
@fanzeyi
fanzeyi / pull-webhook.py
Created May 26, 2019
GitHub stdlib Python webhook for auto pulling (Python 3)
View pull-webhook.py
# -*- coding: utf-8 -*-
import json
import hmac
import hashlib
import subprocess
from http.server import HTTPServer, BaseHTTPRequestHandler
def sign_request(body):
View reshare-to-rebroadcast.user.js
// ==UserScript==
// @name Reshare to Rebroadcast
// @namespace https://zr.is
// @version 0.1.1
// @description Make Douban great again!
// @author Zeyi Fan
// @match https://www.douban.com/*
// @grant none
// ==/UserScript==
View WeiyunExporter.js
(function() {
function escapeQuote(str) {
return str.replace("\"", "\\\"");
}
function buildAria2Url(name, url) {
return `aria2c -c -s10 -k1M -x16 --enable-rpc=false ` +
`-o "${escapeQuote(name)}" ` +
`--header "${escapeQuote(window.navigator.userAgent)}" ` +
`--header "Referer: ${escapeQuote(window.location.toString())}" ` +
View sinon-cheatsheet.js
class Hello {
constructor(foo, bar) {
this.foo = foo;
this.bar = bar;
}
otherfun() {
return 1;
}
View keybase.md

Keybase proof

I hereby claim:

  • I am fanzeyi on github.
  • I am fanzeyi (https://keybase.io/fanzeyi) on keybase.
  • I have a public key whose fingerprint is 5B05 09B5 AF59 BBF1 2CAE B79B F9DB A8F1 81ED 79BF

To claim this, I am signing this object:

View revert-reshare.user.js
// ==UserScript==
// @name Revert Reshare
// @namespace http://zr.is/
// @version 0.3.1
// @description Make Reshare Great Again!
// @author Zeyi Fan
// @match https://www.douban.com/*
// @grant GM_addStyle
// ==/UserScript==
@fanzeyi
fanzeyi / init.lua
Last active Jan 28, 2019
Hammerspoon Configuration
View init.lua
local last_alert = nil
function displaySong(player)
artist, name = player.getCurrentArtist(), player.getCurrentTrack()
if (last_alert ~= nil) then
hs.alert.closeSpecific(last_alert)
end
last_alert = hs.alert.show(artist .. " - " .. name)
View iterm.diff
diff --git a/autoload/dispatch/iterm.vim b/autoload/dispatch/iterm.vim
index 7b52012..068f95f 100644
--- a/autoload/dispatch/iterm.vim
+++ b/autoload/dispatch/iterm.vim
@@ -21,22 +21,23 @@ function! dispatch#iterm#handle(request) abort
endfunction
function! dispatch#iterm#spawn(command, request, activate) abort
- let script = dispatch#isolate([], dispatch#set_title(a:request), a:command)
+ let script = s:isolate(a:request.command)
@fanzeyi
fanzeyi / main.go
Created Jul 5, 2016
A simple TCP echo server for Chrome's native messaging
View main.go
package main
import (
"fmt"
"os"
"net"
"bufio"
"encoding/binary"
)
View code-check-exporter.user.js
// ==UserScript==
// @name Code Check Exporter
// @namespace https://zr.is/
// @version 0.5
// @description Export all files in code checker. (SJSU)
// @author Zeyi Fan (Zeray Rice)
// @match http://cs20.cs.sjsu.edu:8080/codecheck/*
// @grant none
// @require https://raw.githubusercontent.com/Stuk/jszip/v2.4.0/dist/jszip.min.js
// @updateURL https://gist.github.com/fanzeyi/c46ab3dc5319ac24b7f0/raw/code-check-exporter.user.js
You can’t perform that action at this time.