Skip to content

Instantly share code, notes, and snippets.

(progn
(pushnew :python3 *features*)
(ql:quickload :burgled-batteries))
(defun init ()
(burgled-batteries:startup-python)
(burgled-batteries:run "import os,sys"))
(defun sys.version ()
(burgled-batteries:run "sys.version"))
@snmsts
snmsts / memo.md
Last active August 30, 2017 15:31
Iota memo
(xenial)snmsts@localhost:~/work/Iota$ uname -a
Linux localhost 4.4.52-08273-ge6c7193d61d7 #1 SMP PREEMPT Thu Jul 13 12:07:57 PDT 2017 aarch64 aarch64 aarch64 GNU/Linux
(xenial)snmsts@localhost:~/work/Iota$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.3 LTS"
(xenial)snmsts@localhost:~/work/Iota$ free -h
              total        used        free      shared  buff/cache   available
(defun shecomma-reader (stream sub-character infix-parameter)
(declare (ignore sub-character infix-parameter))
(let ((a (gensym "A")))
`(lambda (&rest ,a) (apply ,(read stream nil nil) ,a))))
(set-dispatch-macro-character #\# #\, #'shecomma-reader)
(flet ((f (x) (* 2 x)))
(let ((f (lambda (x) (* 3 x))))
(values (#,#'f 1)(#,f 1))))
;; => 2 , 3
@snmsts
snmsts / dex.lisp
Created February 24, 2017 19:00
dex experiment
(let ((p (find-package :cl+ssl)))
(do-symbols (i p)
(when (and (eql (symbol-package i) p)
(ignore-errors (symbol-function i)))
(let ((f (symbol-function i)))
(unless (typep f 'standard-generic-function)
(setf (fdefinition i)
(lambda (&rest r)
(print (cons i r))
(apply f r))))))))
@snmsts
snmsts / sbcl-1.3.11.patch
Created November 2, 2016 03:50
sbcl-1.3.11-dash-problem
---
+++ make-genesis-2.sh
@@ -1,3 +1,3 @@
#!/bin/sh
-set -em
+set -e
---
+++ make-host-1.sh
@@ -1,3 +1,3 @@
~/work/roswell $ ros scripts/homebrew.ros
url:https://github.com/roswell/roswell/archive/v0.0.6.63.tar.gz
sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
~/work/roswell $ ros scripts/homebrew.ros
url:https://github.com/roswell/roswell/archive/v0.0.6.63.tar.gz
sha256:e40da6ef783e46cb76f239b0667a79b38da6569aed9cac56786f8469f80cbb35
~/work/roswell $ ros scripts/homebrew.ros
url:https://github.com/roswell/roswell/archive/v0.0.6.63.tar.gz
sha256:e40da6ef783e46cb76f239b0667a79b38da6569aed9cac56786f8469f80cbb35
@snmsts
snmsts / shlyfile
Created January 17, 2014 17:15
test
;; -*- lisp -*-
(defvar *current-dir* (make-pathname :type nil :name nil :defaults *load-pathname*))
(push (merge-pathnames "quickdocs/" *current-dir*)
asdf:*central-registry*)
(defvar *output-dir* (merge-pathnames "out/1st/" *current-dir*))
(ql:quickload '(:quickdocs :iolib.syscalls))
(defun doc (a)
@snmsts
snmsts / gist:6761725
Created September 30, 2013 10:00
print runtime environment
(format t "~&~@{~{~A~^ ~}~^~%~}"
`("Lisp:" ,(lisp-implementation-type) ,(lisp-implementation-version))
#+quicklisp `("Quicklisp:" "Version",(quicklisp-client::local-version) ,(ql-dist:all-dists))
#-quicklisp `("Quicklisp:" "Not installed"))
@snmsts
snmsts / shlyfile
Created September 27, 2013 10:49
test with shlyfile
(defun which (bin &key a)
(let* ((paths (mapcar #'(lambda (x) (make-pathname :defaults (format nil "~A/" x)))
(asdf::split-string (asdf::getenv "PATH") :separator '(#\:))))
found)
(setq found (flet ((test (x y)
(cl-fad:file-exists-p (merge-pathnames x y))))
(if a
(remove bin paths :test (complement #'test))
(find bin paths :test #'test))))
@snmsts
snmsts / hello world
Created September 4, 2013 04:17
generate "Hello World" without including any literal.
(defmacro def-print-string (name string)
`(defun ,name ()
(let ((one (count t'(t))))
(print
(coerce
(mapcar #'code-char
(list
,@(loop :for i :across string
:collect
`(+ ,@(loop :for j := (char-code i) :then (floor j #.(count t'(t t)))