Skip to content

Instantly share code, notes, and snippets.

View letoh's full-sized avatar
💭
I may be slow to respond.

letoh letoh

💭
I may be slow to respond.
View GitHub Profile
原文 GG 了請參考 archive
https://web.archive.org/web/20090221093708/http://d.hatena.ne.jp/yuki_neko_nyan/20090217/1234850409
以下備份
2009-02-17
■ループが書けなくなる(或いは再帰依存症)レベル10 15:00 ループが書けなくなる(或いは再帰依存症)レベル10 - 猫的怠惰Days
level 0
#include <stdio.h>
#define progn(...) ({ __VA_ARGS__ ;})
#define cond0 (argc < 2)
#define cond1 (argc < 3)
#define cond2 (argc < 4)
#define cond3 (argc < 5)
#define a progn(printf("do something\n"), "a")
diff --git a/Makefile b/Makefile
index 9207d9e..4acade0 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
ALL=re2 pcre onig boost
CC=$(CXX)
-CXXFLAGS=-O5
+CXXFLAGS=-O3
@letoh
letoh / gist:9521351
Created March 13, 2014 03:14
Palindrome
palindrome = lambda s: s[len(s)/2:][::-1].find(s[:len(s)/2])!=-1
palindrome = lambda s: s[len(s)/2:][::-1].startswith(s[:len(s)/2])
palindrome = lambda s: reduce(lambda a,b: a and (b[0]==b[1]), zip(s,s[::-1]), True)
palindrome = lambda s: reduce(lambda a,b:a and b,map(lambda x:x[0]==x[1],zip(s,s[::-1])))

音樂相關傳記電影

@letoh
letoh / install_emacs.txt
Created October 18, 2013 03:58
install a context menu entry for emacs
REGEDIT4
[HKEY_CLASSES_ROOT\*\shell]
[HKEY_CLASSES_ROOT\*\shell\Emacs]
@="Edit with &Emacs"
[HKEY_CLASSES_ROOT\*\shell\Emacs\command]
@="D:\\Programs\\emacs\\bin\\emacsclientw.exe --no-wait --alternate-editor=D:/Programs/emacs/bin/runemacs.exe \"%1\""
@letoh
letoh / gist:6281840
Created August 20, 2013 13:59
parsing test
(with-current-buffer "abc"
(with-output-to-temp-buffer "*result*"
(goto-char (point-min))
(let* ((template (concat "<!-- 一篇推文開始 -->
<section>
<a class=\"username\" href=\"https://twitter.com/%s\">%s</a>
<a class=\"date\" href=\"%s\">%s</a>
<div class=\"tweetcontent\">%s</div>
</section>
(defun self-hater ()
(font-lock-add-keywords
nil `(("\\(\\<self\\>\\)"
(0 (progn (compose-region
(match-beginning 1) (match-end 1)
"(╯°□°)╯︵ ┻━┻")
nil))))))
(add-hook 'python-mode-hook #'self-hater)
(defun dired-show-only (regexp)
(interactive "sFiles to show (regexp): ")
(dired-mark-files-regexp regexp)
(dired-toggle-marks)
(dired-do-kill-lines))