Skip to content

Instantly share code, notes, and snippets.

diff --git a/test-suite/tests/web-client.test b/test-suite/tests/web-client.test
index 3133b73..6038398 100644
--- a/test-suite/tests/web-client.test
+++ b/test-suite/tests/web-client.test
@@ -299,13 +299,28 @@ Content-Language: en
")
;; Unfortunately, POST to http://www.gnu.org/software/guile/ succeeds!
+(define post-request-headers-null:www.apache.org/
+ "POST / HTTP/1.1
@NalaGinrut
NalaGinrut / gg.scm
Last active December 23, 2015 23:29
求from到to之间所有勾股数
(use-modules (srfi srfi-1) (ice-9 control))
(define (either . args) (shift k (for-each k args)))
(define (sq x) (* x x))
(define (choice from to)
(reset (let ((ll (iota to from)))
(let ((x (apply either ll))(y (apply either ll))(z (apply either ll)))
(if (= (sq z) (+ (sq x) (sq y)))
(format #t "~a^2 + ~a^2 = ~a^2~%" x y z))))))
@NalaGinrut
NalaGinrut / print-doc.scm
Created October 10, 2013 08:34
print all doc-string in current-module in Guile
(for-each (lambda (s)
(let ((p (module-ref (current-module) s)))
(if (procedure? p)
(format #t "[~a]~%~@[~a~%~]" p (procedure-documentation p)))))
(apropos-internal ".*"))
@NalaGinrut
NalaGinrut / play.sh
Last active December 27, 2015 15:49
play piano in terminal
#!/bin/bash
while read -e input
do
for i in $input
do
play -q -n synth 3 pluck %$(expr index abbccddeeffgg $i - 1) &
sleep 0.5
done
done
@NalaGinrut
NalaGinrut / a.asm
Created December 31, 2013 03:28
A case for %Pn in GCC inline ASM
cat test.c
------------------------------------------------------------
int main(int argc, char * argv[]) {
__asm__ ("call __foo_bar_%P0" : : "i"(42));
return 0;
}
------------------------------------------------------------
gcc -S test.c
cat test.s
@NalaGinrut
NalaGinrut / yy.scm
Last active August 29, 2015 13:57
yy research code
(define (yy-print fmt . args)
;; if Guile
(apply format #t fmt args)
;; if Racket
;;(apply printf fmt args)
)
(define (inc x)
;; if Guile
(1+ x)
@NalaGinrut
NalaGinrut / multi-assign.scm
Created April 17, 2014 10:08
A macro for multi assign
(define-syntax sets!
(syntax-rules ()
((_ (var) (val))
(set! var val))
((_ (var vars* ...) (val vals* ...))
(let ((var0 val))
(sets! (vars* ...) (vals* ...))
(set! var var0)))))
@NalaGinrut
NalaGinrut / ts.py
Created April 24, 2014 09:17
timestamp watermark
#!/usr/bin/python
from PIL import Image, ImageDraw
import time, os, sys
ori, des = sys.argv[1:]
im = Image.open(ori)
draw = ImageDraw.Draw(im)
textPadding = 5
@NalaGinrut
NalaGinrut / lexer.scm
Last active August 29, 2015 14:02
string lexer
(use-modules (ice-9 rdelim) (rnrs))
(define (k f init val pred)
(if (pred val)
init
(call-with-values (lambda () (f init val))
(lambda (lst rst) (k f lst rst pred)))))
(define (lexer str delimiters)
(define (-> c)
@NalaGinrut
NalaGinrut / 0_reuse_code.js
Created July 3, 2014 03:08
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console