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
from sets import Set | |
def gen_xfix_set(string, generator): | |
ret,n = Set([]),len(string)-1 | |
while True: | |
if n==0: return ret | |
else: | |
ret.add(generator(string, n)) | |
n -= 1 |
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
(use-modules (system foreign) (rnrs bytevector)) | |
;; TODO: | |
;; 1. (> hi (bytevector-length bv)) | |
;; 2. (< lo 0) wrap reference | |
(define (%bytevector-slice bv lo hi) | |
(and (< hi lo) (error %bytevector-slice "wrong range" lo hi)) | |
(let* ((ptr (bytevector->pointer bv)) | |
(addr (pointer-address ptr)) | |
(la (+ addr lo)) |
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 sm '((0 ("A" 1)) (1 ("A" 3) ("B" 2)) (2 (end 2) ("C" 7)) (3 ("B" 4)) | |
(4 ("B" 6) (end 4)) (6 (end 6)) (7 ("C" 8)) (8 ("D" 9)) (9 (end 9)))) | |
(define ll '((2 . "AB") (4 . "AAB") (6 . "AABBB") (9 . "ABCCD"))) | |
(define (my-lexer str) | |
(call-with-input-string | |
str | |
(lambda (port) | |
(let lp((stat 0) (c (read-char port)) (ret '())) | |
(if (eof-object? c) | |
(let* ((now (assoc-ref sm stat)) (w (assoc-ref now 'end))) |
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
;; All hail the RECV form | |
(define-syntax-rule (recv . clauses) | |
(let ((msg (gensym "msg")) ;; the current mailbox message | |
(loop (gensym "loop"))) ;; the mailbox seeking loop | |
;; check the last clause to see if it's a timeout | |
(let ((sesualc (reverse clauses))) | |
(if (and (pair? (car sesualc)) | |
(eq? (caar sesualc) 'after)) |
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 <sys/times.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
int main() | |
{ | |
struct tms buf; | |
if (times(&buf) < 0) | |
exit(115); |
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
(use-modules (ice-9 match)) | |
(define test | |
'((begin-program self1180 ()) | |
(label kentry1181) | |
(begin-kw-arity (x y) () #f () #f 3 #f) | |
(label kargs1182) | |
(add 1 1 2) | |
(label ktail1189) | |
(return 1) |
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
String sStart = "1111111110000000000"; | |
String sStop = "0"; | |
int data_to_spoof[64]; | |
int coil_pin = 9; // we use 9th pin | |
int a,b,c,d; | |
unsigned long id; | |
char hex_code[8]; | |
void setup() | |
{ |
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
def str_to_playframe(s0): | |
ss = s0.decode("utf-8") | |
l = "%c%c" % ((len(ss)&0xff00)>>8, len(ss)&0xff) | |
s = ss.encode("GB2312") | |
op = "\x01\x00" | |
return "\xfd" + l + op + s |
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 *stpl-SRE* '(or (=> dollar "$$") | |
(: "${" (=> name (+ (~ #\}))) "}"))) | |
(define (make-string-template str . opts) | |
(define ll '()) | |
(define lv '()) | |
(define template | |
(irregex-replace/all | |
;;"(\\$\\{([^$])+\\})" | |
*stpl-SRE* str | |
(lambda (m) |
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-module (test-suite web-client) | |
#:use-module (web client) | |
#:use-module (web request) | |
#:use-module (web response) | |
#:use-module (ice-9 iconv) | |
#:use-module (ice-9 binary-ports) | |
#:use-module (test-suite lib)) | |
(define get-request-headers:www.gnu.org/software/guile/ |