Skip to content

Instantly share code, notes, and snippets.

View Yoxem's full-sized avatar

Tan, Kian-ting Yoxem

View GitHub Profile
@Yoxem
Yoxem / footnote.js
Last active December 23, 2015 11:22 — forked from kuanyui/footnote.js
/*
footnote.js: A filter for Hexo to generate footnotes. Place this file in /scripts/footnote.js.
========================================================================
Author: kuanyui(azazabc123[at]g~~~m~~~a~~~i~~~l[dot]com), Yoxem (yoxem。tem98<at>nctu<d0t>edu<point>tw)
Date: 20140622
License: WTFPL 1.0
========================================================================
The following string in article
{fn|I'm the a lot lot of content.}
@Yoxem
Yoxem / .emacs_partial
Last active August 29, 2015 14:04
設定全局字型之 .emacs 指令
;;set font by kuanyui
;; (dolist (charset '(hangul kana han symbol cjk-misc bopomofo))
;;(set-fontset-font (frame-parameter nil 'font) charset
;;(font-spec :family "文泉驛等寬微米黑" :spacing 100 :size nil)))
;; 來源:http://www.emacswiki.org/emacs/SetFonts#toc2
;; 設定全局字型
(set-face-attribute 'default nil :font "文泉驛等寬微米黑" )
(set-frame-font "文泉驛等寬微米黑" nil t)
@Yoxem
Yoxem / list_tweet_dumper.py
Last active August 29, 2015 14:06 — forked from dmn001/tweet_dumper.py
list tweet dumper - get word of tweets of the timeline of a list.
#!/usr/bin/env python
# encoding: utf-8
#list_tweet_dumper - get word of tweets of the timeline of a list.
import tweepy #https://github.com/tweepy/tweepy
import csv
#Twitter API credentials
consumer_key = ""
consumer_secret = ""
@Yoxem
Yoxem / PhakFaSutoTHRS.js
Last active September 23, 2017 10:59
PhakFaSutoTHRS.js
// a converter from Hakka pha̍k-fa-sṳ to Taiwanese Hakka Romanization System in Miaoli Sixian dialect
// demo: http://yoxem.github.io/2015/01/03/Hakka_Phak-fa-su_to_Taiwanese_Hakka_Romanization_System/
// ver 0.12 on 2016-01-03 under MIT/X11 license
//XRegExp 2.0.0 <xregexp.com> MIT License from here
var XRegExp;XRegExp=XRegExp||function(n){"use strict";function v(n,i,r){var u;for(u in t.prototype)t.prototype.hasOwnProperty(u)&&(n[u]=t.prototype[u]);return n.xregexp={captureNames:i,isNative:!!r},n}function g(n){return(n.global?"g":"")+(n.ignoreCase?"i":"")+(n.multiline?"m":"")+(n.extended?"x":"")+(n.sticky?"y":"")}function o(n,r,u){if(!t.isRegExp(n))throw new TypeError("type RegExp expected");var f=i.replace.call(g(n)+(r||""),h,"");return u&&(f=i.replace.call(f,new RegExp("["+u+"]+","g"),"")),n=n.xregexp&&!n.xregexp.isNative?v(t(n.source,f),n.xregexp.captureNames?n.xregexp.captureNames.slice(0):null):v(new RegExp(n.source,f),null,!0)}function a(n,t){var i=n.length;if(Array.prototype.lastIndexOf)return n.lastI
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
;;change the [n]-th item of a list [ls] to [new_val]. Return the modified list.
;; ([ls LIST] [n INT] [new_val ANY]) -> LIST
;; eg. (list-set '("a" "b" "c") 1 2) -> ("a" 2 "c")
(define (list-set ls n new_val)
(list-set-iter '() ls (modulo n (length ls)) new_val 0)
)
(define (list-set-iter ls_left ls_right n new_val counter)
(if (< counter n)
;; split a string with a token-list
;; eg.
;; (string-split "dccdd53cccdd" '(#\c #\d))-> ("d" "c" "c" "d" "d" "53" "c" "c" "c" "d" "d" "")
;; (string-split "demo, char., detecting " '(#\c #\d)) -> ("d" "emo, " "c" "har., " "d" "ete" "c" "ting ")
(define (string-split string token-list)
(define temp-string "")
(string-split-iter token-list string temp-string '()))
(define (string-split-iter token-list rest-string temp-string result-list)
(define rest-str-len (string-length rest-string))
@Yoxem
Yoxem / parser.py
Last active May 11, 2016 18:09
Simple recursive descent (?) parser with a tiny tokenizer function in Python 3
#!/usr/bin/env python3
import re
token_pattern = \
[
[r'[+]', 'ADD'],
[r'[-]', 'SUB'],
[r'[+-]?[0-9]*\.[0-9]+(e[+-]?[0-9]+)?','FLOAT'],
[r'[+-]?[0-9]+','INT'],
[r'[*]', 'MUL'],
@Yoxem
Yoxem / test.c
Created November 17, 2016 15:35
practice about string manupilation
#include <stdio.h>
#include <string.h>
int main(int argc, const char * argv []) {
char *your_name_input = "";
printf("Input your name >>");
scanf("%s",&your_name_input);
printf("Your name is %s; The length is %d.\n", &your_name_input,
strlen(&your_name_input));
}
@Yoxem
Yoxem / pi.scm
Last active March 14, 2017 12:59
Find the approximation of pi
(define (pi-iter i max sum)
(if (= i max)
(* 4 sum)
(let ((k (/
(^ (- 1) i)
(+ (* 2 i) 1))))
(pi-iter (+ i 1) max (+
sum
k)))
))