Skip to content

Instantly share code, notes, and snippets.

View GHolk's full-sized avatar

Gold Holk GHolk

View GitHub Profile
@GHolk
GHolk / tamagotchi.js
Created September 20, 2017 16:49
tamagochi prototype
var tamagotchi = {}
var action = {}
action.doNothing = function () {}
action.standBy = function () {
var date = new Date()
if (date.getMilliseconds() % 10000 == 0) {
this.say('hello master')
@GHolk
GHolk / clean-window.user.js
Last active February 4, 2018 02:21
greasy monkey script, when click hyperlink with win key down, will open link in new window without toolbar, location bar. if in youtube, would open embed player page.
// ==UserScript==
// @name open clean window
// @namespace http://gholk.github.io/
// @description when click mouse with WinKey, open ancher in new window without toolbar, manubar, location bar.
// @match <all_urls>
// @version 10
// @grant none
// ==/UserScript==
@GHolk
GHolk / find-base64-fragment-order.sh
Last active February 7, 2018 06:51
help find possible order of unorder base64 fragment
#!/bin/sh
# this script help find possible order of base64 fragment.
#
# like "hello world" is aGVsbG8gd29ybGQ= ,
# it would help find "hello world" from "G8g Vsb d2 9yb GQ= aG"
#
# usage: sh find-base64-fragment-order.sh $known_start $frag1 $frag2 ...
# unknown init base:
# sh find-base64-fragment-order.sh '' G8g Vsb d2 9yb GQ= aG
# know start with h, which is `a` in base64, so first is `aG`
@GHolk
GHolk / danmo.js
Created March 3, 2018 09:00
簡單的彈幕 javascript 實現
const sentence = [
'為什麼高中生 很愛參加台大杜鵑花節?',
'女兒被假爸舔臉頰會有心理陰影嗎',
'乙武洋匡屌打板上肥宅幾條街?',
'沈志霖 PTT鄉民xmanhman你錯了!',
'西半部空品「一片紅」 台中電廠降載1260M',
'年營收16億 486先生仍騎車上班',
'原來護廷十三番藍染隊長是叛徒?!',
'稱台灣旅行法=「台灣毀滅法」 邱毅遭嗆:',
@GHolk
GHolk / grease-monkey-repl.user.js
Last active May 6, 2018 09:02
read evaluate print loop of grease monkey environment
// ==UserScript==
// @name greasy monkey repl
// @description read evaluate print loop of grease monkey environment
// @namespace http://gholk.github.io/
// @version 4
// @match *
// @grant GM.info
// @grant GM.deleteValue
// @grant GM.getValue
// @grant GM.listValues
@GHolk
GHolk / bbsjs.user.js
Last active May 6, 2018 09:56
execute javascript in ptt chrome
// ==UserScript==
// @name chrome bbs javascript executor
// @namespace http://gholk.github.io/
// @description press J in term.ptt.cc can run JavaScript
// @match https://term.ptt.cc/*
// @match https://www.clam.ml/*
// @match https://www.ptt.cc/bbs/*
// @version 15
// @grant none
// ==/UserScript==
@GHolk
GHolk / async.js
Last active May 22, 2018 12:59
wrap wrap wrap!
function patchGeneratorFunction() {
const GeneratorFunction = function *(){}.constructor
GeneratorFunction.prototype.asyncCallback = function () {
return CallbackAsync.fromGeneratorToCallback(this, ...arguments)
}
GeneratorFunction.prototype.asyncPromise = function () {
return PromiseAsync.fromGeneratorToPromise(this, ...arguments)
}
GeneratorFunction.prototype.async = GeneratorFunction.prototype.asyncPromise
@GHolk
GHolk / flolac-prerequisites.hs
Created May 31, 2018 09:25
2018 年報名 flolac 所要求的課前測驗
-- 作者 gholk
-- 日期 2018-05-31
{- 2018 年報名 flolac 所要求的課前測驗,
昨天看完前三章,現在邊看第四章邊把測驗寫完了。 -}
-- 1
myFst :: (a,b) -> a
myFst (a,b) = a
@GHolk
GHolk / monkey-hackmd-bookmode.user.js
Last active June 3, 2018 14:12
monkey patching bookmode for hackmd
// ==UserScript==
// @name monkey hackmd toc
// @namespace http://gholk.github.io
// @version 9
// @grant none
// @match https://hackmd.io/*
// @match https://hackmd.ccns.ncku.edu.tw/*
// ==/UserScript==
/* this script monkey patch the hackmd easy content table,
@GHolk
GHolk / maze-connect.c
Last active November 3, 2018 11:19
determine two point in ascii maze is connect
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include <inttypes.h>
#define putsNoLn(string) fputs(string, stdout)