Skip to content

Instantly share code, notes, and snippets.

View guicho271828's full-sized avatar
🤣
Lemonodor fame is but a hack away!

Masataro Asai guicho271828

🤣
Lemonodor fame is but a hack away!
View GitHub Profile
SFMT-TEST> (set-pi32 1 2 3 4)
#<SB-EXT:SIMD-PACK 04 00 00 00 03 00 00 00 02 00 00 00 01 00 00 00> ; 128 bit, equiv. one XMM
SFMT-TEST> (set-pi32 129 130 131 132)
#<SB-EXT:SIMD-PACK 84 00 00 00 83 00 00 00 82 00 00 00 81 00 00 00>
(defun myarray (a b c d)
(declare ((signed-byte 32) a b c d))
(declare (notinline make-sse-array))
(let ((tmp (the (sse-array (signed-byte 32))
set terminal pdf enhanced monochrome dashed size 1.6,1.6 font \"Times New Roman, 12\"
set output \"actualsearchtime.pdf\"
set size square
set logscale xy
set title \"Search Time [sec]\"
set title offset 0,-0.7
set format xy \"10^{%L}\"
set tmargin 1
set xlabel offset 0,1
set ylabel offset 1,0
typedef union
{
struct
{
int __lock;
unsigned int __futex;
unsigned long long int __total_seq;
unsigned long long int __wakeup_seq;
unsigned long long int __woken_seq;
void *__mutex;
; (definstance (ord string)
; (defun = (x y) (string= x y))
; (defun > (x y) (string> x y)))
(PROGN
(FTYPE =/STRING/STRING STRING STRING BOOLEAN)
(DEFUN =/STRING/STRING (X Y) (STRING= X Y))
(DEFINE-COMPILER-HINT =
(X Y &ENVIRONMENT #:ENV1822)
(STRING STRING BOOLEAN)
(IF (AND (FORM-TYPEP X 'STRING #:ENV1822) (FORM-TYPEP Y 'STRING #:ENV1822))
@guicho271828
guicho271828 / typevar.lisp
Last active August 29, 2015 14:15
introducing typevar into common lisp
(with-typevar <coordinate> (<t>) (<vector-+>)
(defstruct <coordinate>
(x 0 :type <t>)
(y 0 :type <t>))
(declaim (ftype (function (<coordinate> <coordinate>) <coordinate>) <vector-+>))
(defun <vector-+> (v w)
(match* (v w)
(((<coordinate> x1 y1) (<coordinate> x2 y2))
(<coordinate> (+ x1 x2) (+ y1 y2))))))
@guicho271828
guicho271828 / big-table.lisp
Created February 19, 2015 18:58
figure for ICAPS15
(defun %length-distribution (&optional used)
(let ((path
(merge-pathnames
(format nil "output/~(~{~a-~}dist~@[-used~]~).pdf"
*set-dirs* used)))
(*solver-blacklist* '(fffd fffdtl mv2 mv2tl)))
(includegraphics (namestring path))
(let ((hist (associative-array 2)))
(dolist (s (solvers))
(dolist (d (domains))
@guicho271828
guicho271828 / Makefile
Created January 14, 2015 12:44
Makefile for converting C header files with GCC extensions into CFFI binding using SWIG
.PHONY: all clean
# .PRECIOUS: %.i1 %.i2 %.i3
LD = -I/usr/include -I/usr/include/linux
headers = $(shell ls *.h)
$(info $(headers))
lisp = $(patsubst %.h,%.lisp,$(headers))
@guicho271828
guicho271828 / interrupt.lisp
Last active August 29, 2015 14:07
interrupt
(defun run ()
(tagbody
(handler-bind ((condition
(lambda (c)
(declare (ignore c))
(go :escape))))
(restart-bind ((my-continue
(lambda ()
@guicho271828
guicho271828 / doubling-qsub.sh
Last active August 29, 2015 14:05
iterative resource allocation
#!/bin/bash
dir=$(dirname $(readlink -ef $0))
cg=/sys/fs/cgroup
mem=250000 # 250MB
maxmem=2000000 # 2GB: *8
time=225 # 3.75 min = 30/4
maxtime=1800 # 30 min
options=
debug=false
@guicho271828
guicho271828 / test.lisp
Last active August 29, 2015 14:04
hightlight use-/def-/in-
(use-syntax :annot
(cl-syntax:use-syntax (%_!$&=~^-[]+*?/<>.:annot))
(cl-syntax:use-syntax (%_!$&=~^-[]+*?/<>.:annot aaa) aaa)
`(cl-syntax:use-syntax (`,%_!$&=~^-[]+*?/<>.:annot aaa) aaa)
(defun (defun (cl:defun aaa (aaa) bbb)))
(defo (defun (cl:defun aaa (aaa) bbb)))
(use-defo (defun (cl:defun aaa (aaa) bbb)))