Skip to content

Instantly share code, notes, and snippets.

(use-modules (srfi srfi-1)
(ice-9 pretty-print))
(define (sum ls)
(if (null? ls)
0
(+ (car ls) (sum (cdr ls)))))
(define (sum2 ls)
(apply + ls))
;; This buffer is for notes you don't want to save, and for Lisp evaluation.
;; If you want to create a file, visit that file with C-x C-f,
;; then enter the text in that file's own buffer.
(defun comment-toggle-current-line ()
"comment or uncomment current line"
(interactive)
(comment-or-uncomment-region (line-beginning-position) (line-end-position)))
(global-set-key (kbd "M-[") 'comment-toggle-current-line)
open Core.Std
open Lwt
let usb_send_recv send recv =
let device = USB.open_device_with ~vendor_id:0x0000
~product_id:0x0000 in
let t =
USB.claim_interface device 0
>>=
open Core.Std
open Lwt
let cmd = "\x00\x00\x00\x00\x00\x00\x00\x00";;
let buf = String.make 500 (char_of_int 0);;
let device = USB.open_device_with ~vendor_id:0x0CA6 ~product_id:0xA010 in
let t =
USB.claim_interface device 0
@b4284
b4284 / ocaml
Created January 13, 2016 18:11 — forked from anonymous/ocaml
This file has been truncated, but you can view the full file.
(0x6EAB, ["UC";"C/U";"CPU"]);
(0x5ABC, ["W/U";"WPU"]);
(0x555F, ["G;.";"G.;"]);
(0x83A0, ["FLVG";"FLVL"]);
(0x4E38, ["LSH";"SLH"]);
(0x5E7E, ["XZ";"XXZX";"XXAX"]);
(0x7228, ["OUD,";"OJA,";"OJQ,"]);
(0xFF0C, [","]);
(0x3002, ["."]);
(0x53E3, [";"]);
@b4284
b4284 / ar30.ml
Created January 13, 2016 18:10 — forked from anonymous/ar30.ml
(0x6EAB, ["UC";"C/U";"CPU"]);
(0x5ABC, ["W/U";"WPU"]);
(0x555F, ["G;.";"G.;"]);
(0x83A0, ["FLVG";"FLVL"]);
(0x4E38, ["LSH";"SLH"]);
(0x5E7E, ["XZ";"XXZX";"XXAX"]);
(0x7228, ["OUD,";"OJA,";"OJQ,"]);
(0x25CB, ["OU";";"]);
(0x7684, ["LPLH";"T"]);
(0x4E09, ["S/";"AAA"]);
(use-modules (srfi srfi-1))
(define* (partition-by f l #:optional (p eqv?))
(if (null? l)
'()
(let A ((L '()) (M (list (car l))) (R (cdr l)) (f1 (f (car l))))
(if (null? R)
(reverse (cons (reverse M) L))
(let* ((R1 (car R)) (f2 (f R1)) (R2 (cdr R)))
(if (p f1 f2)
@b4284
b4284 / new_year_play.sh
Created December 31, 2015 15:16
Shell script to play your song right at the moment of clock zero 2016 !
START_TIME=$(( $(date -d "2016-01-01 00:00:00" +%s) - 60 * $MINUTE - $SECOND ))
while :; do
if [[ $(date +%s) -ge $START_TIME ]]; then
mplayer $FILE;
break;
fi;
sleep 1;
000000000040069a <xorswap>:
40069a: 8b 07 mov (%rdi),%eax
40069c: 33 06 xor (%rsi),%eax
40069e: 89 07 mov %eax,(%rdi)
4006a0: 33 06 xor (%rsi),%eax
4006a2: 89 06 mov %eax,(%rsi)
4006a4: 31 07 xor %eax,(%rdi)
4006a6: c3 retq
00000000004006a7 <swap>:
#include <libtcc.h>
#include <stdio.h>
#include <stdlib.h>
void gen_addx(char *s, int x) {
sprintf(s, "\
int addx(int y) { \
return (%d + y); \
}", x);
}