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
;; | |
;; xyzzy の network stream からソケットハンドルを無理やり取り出してみる PoC | |
;; メモリレイアウトに依存する危険な処理なので良い子は真似しないように | |
;; | |
;; Windows SDK/.../WinSock2.h | |
(c:define SOL_SOCKET #xffff) | |
(c:define SO_SNDTIMEO #x1005) | |
(c:define SO_RCVTIMEO #x1006) |
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
;; xyzzy の curl バインディング (PoC) | |
;; | |
;; http://curl.haxx.se/ | |
;; http://www.gknw.net/mirror/curl/win32/curl-7.23.1-ssl-sspi-zlib-static-bin-w32.zip | |
;; curl.h | |
(defconstant CURLOPTTYPE_LONG 0) | |
(defconstant CURLOPTTYPE_OBJECTPOINT 10000) | |
(defconstant CURLOPTTYPE_FUNCTIONPOINT 20000) | |
(defconstant CURLOPTTYPE_OFF_T 30000) |
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
;; xyzzy だとすっごい遅い。 | |
;; Ctrl-g で止めることもできないからプロセスを殺すしかない。 | |
(string-match | |
"a+\\|b" | |
(make-sequence 'string 50000 :initial-element #\a)) | |
0 | |
;; ruby だと一瞬。 | |
> ruby -e "p ('a'*50000) =~ /a+|b/" |
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
(equalp (alexandria:plist-hash-table '(:foo 1 :bar 2)) | |
(alexandria:plist-hash-table '(:foo 1 :bar 2))) | |
t | |
t | |
(equalp (alexandria:plist-hash-table '(:foo 1 :bar 2)) | |
(alexandria:plist-hash-table '(:foo 1))) | |
nil | |
(equalp (alexandria:plist-hash-table '(:foo 1 :bar 2)) |
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
;; | |
;; バッファ内に書いてある数式を計算して答えを挿入 | |
;; | |
;; 例 | |
;; 1 + 1 ってバッファに書いておいてリージョンで囲って M-x eval-calc-region | |
;; | |
(require "calc") | |
(defun eval-calc-region (s e) |
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
;; | |
;; あるパッケージ内で定義されているシンボルの中から | |
;; ansify にあるシンボルと未定義のシンボルを取得して、 | |
;; パッケージのテンプレートを生成する。 | |
;; | |
;; cl-hogehoge の移植用に。 | |
;; | |
;; 以下で定義している関数を利用しています。 | |
;; | |
;; #xyzzy にはないシンボルと ansify にあるシンボルに色をつけるためのキーワードファイルの生成 |
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
;; | |
;; xyzzy にはないシンボルと ansify にあるシンボルに色をつけるためのキーワードファイルの生成 | |
;; | |
;; Usage: | |
;; M-x update-keyword-file | |
;; | |
(require "ansify") | |
(require "xl-ppcre") |
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
(defpackage :hoge | |
(:use :lisp) | |
(:shadowing-import-from :ansify | |
:typecase) | |
(:shadowing-import-from :ansi-loop | |
:loop) | |
(:shadow | |
:car)) | |
;=> :shadowと:shadowing-import-fromでcarが2回以上指定されています |
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
;; (require "xl-alexandria/test/test-base") しただけで xyzzy がクラッシュすることがある | |
;; | |
;; とりあえず以下で回避。クラッシュする原因は不明。 | |
diff --git a/site-lisp/lisp-unit.l b/site-lisp/lisp-unit.l | |
index 52a9b21..4f5ccdd 100755 | |
--- a/site-lisp/lisp-unit.l | |
+++ b/site-lisp/lisp-unit.l | |
@@ -333,7 +333,7 @@ For more information, see lisp-unit.html. | |
(defun remove-all-tests (&optional (package *package*)) |
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
;; xyzzy の real 型で数字の範囲を指定して deftype できない | |
(deftype negative-real () | |
`(real * (0))) | |
;=> negative-real | |
(typep -1 (si:canonicalize-type 'negative-real)) | |
;=> t | |
(typep 1 (si:canonicalize-type 'negative-real)) | |
;=> t |