This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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))) | |
)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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)); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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'], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 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)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;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) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 = "" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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.} |
NewerOlder