This file contains 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
function interpret(form, env, k){ | |
if(form instanceof Array){ | |
switch(form[0]){ | |
case 'lambda': { | |
var params = form[1]; | |
var body = form[2]; | |
return k(function(k){ return function() { | |
var e = Object.create(env); | |
for(var j = 0; j < params.length; j++) | |
e[params[j]] = arguments[j]; |
This file contains 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
char** fizzBuzz(int n, int* returnSize) { | |
struct _ { | |
char *rets[n + 1]; | |
char data[0]; | |
} * ret = calloc(sizeof(struct _) + n * 9 + 1, sizeof(char)); | |
*returnSize = n; | |
char * sp = ret->data; | |
for (int i = 1; i <= n; ++i, sp += 9) { | |
ret->rets[i - 1] = sp; |
This file contains 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
https://dtwnuis9ywd79.cloudfront.net/paijo/images/paijo_vol28.png | |
「語言不分貴賤」 | |
This file contains 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
BIN = test-app | |
all: $(BIN) | |
test-app: a.lisp b.lisp | |
ccl64 -l build.lisp | |
clean: | |
rm -f $(BIN) |
This file contains 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
;;; 只在 Org 8.2.10 測試過 | |
;;; 應該可以放到 org-load-hook 之類的地方吧... | |
;; 允許中文全形標點緊接在 emphasis marker 前後 (i.e. pre-, post-match) | |
;; 例: ,*中文* 或 +測試+。 | |
(setcar (nthcdr 0 org-emphasis-regexp-components) " \t('\"{、,。:;?「」『』〈〉《》>【】﹝﹞") | |
(setcar (nthcdr 1 org-emphasis-regexp-components) "- \t.,:!?;'\")}\\、,。:;?「」『』〈〉《》【】﹝﹞") | |
;; 允許 , ' " 這三個標點出現在緊臨 emmphasis marker 內側的位置 | |
;; 例: ="= 或 =123"= | |
(setcar (nthcdr 2 org-emphasis-regexp-components) " \t\r\n") |
This file contains 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
// modified from b****'s implementation https://gist.github.com/anonymous/aaafa4bd4de9d1a8ffa0 | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdint.h> | |
#include <string.h> | |
#include <stdarg.h> | |
enum {n, y, d, o, r, e, m, s, _}; | |
int to_num(char hash[], ...) { |
This file contains 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> | |
#include <db.h> | |
#define F_NUM(name) \ | |
long name | |
#define F_TEXT(name,n) \ | |
struct { int len; char data[n]; } name | |
#define REC(name) struct Rec_##name |
This file contains 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
[alias] | |
st = status | |
ci = commit | |
co = checkout | |
up = checkout | |
br = branch -v | |
cia = commit -a | |
di = diff --color | |
gr = grep -n | |
log1 = log --pretty=format:"%h %ad | %s%d [%an]" --graph --date=short |
This file contains 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
#!/bin/sh | |
date | md5sum | |
date +%s | sha256sum | base64 | head -c 32; echo | |
< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-32};echo; | |
openssl rand -base64 32 | |
openssl rand -base64 37 | cut -c1-37 | |
tr -cd '[:alnum:]' < /dev/urandom | fold -w30 | head -n1 | |
strings /dev/urandom | grep -o '[[:alnum:]]' | head -n 30 | tr -d '\n'; echo | |
< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c6 |
This file contains 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
;; goal in elisp | |
;; emacs -batch -Q -l goal.el | |
(defmacro g (&rest al) | |
`(concat "g" | |
(apply 'concat | |
(mapcar (lambda (o) | |
(if (null o) "o" | |
(if (listp o) (car o) |
NewerOlder