Skip to content

Instantly share code, notes, and snippets.

Avatar
😇
nemui

Eitaro Fukamachi fukamachi

😇
nemui
View GitHub Profile
@fukamachi
fukamachi / clhs.ros
Last active Jan 21, 2018
A Roswell script for opening HyperSpec page describing a given symbol in the default browser.
View clhs.ros
#!/bin/sh
#|-*- mode:lisp -*-|#
#|
exec ros -Q -- $0 "$@"
|#
#|
A Roswell script to open the HyperSpec page of a specified symbol in the default browser.
@fukamachi
fukamachi / lock-pool
Created Oct 14, 2017
Lock to allow n times to acquire
View lock-pool
(defpackage #:lock-pool
(:use #:cl)
(:import-from #:bordeaux-threads)
(:import-from #:alexandria
#:once-only)
(:export #:lock-pool
#:make-lock-pool
#:acquire-lock-in-pool
#:release-lock-in-pool
#:with-lock-pool-held))
@fukamachi
fukamachi / hubotify.ros
Created Dec 24, 2015
Generate a Hubot script (.js file) from the given Roswell script.
View hubotify.ros
#|-*- mode:lisp -*-|#
#|
exec ros -Q -- $0 "$@"
|#
#|
Generate a Hubot script (.js file) from the given Roswell script.
Usage:
$ hubotify <roswell script>
@fukamachi
fukamachi / Dockerfile
Created Jun 16, 2015
Dockerfile for building an image of Ubuntu with Roswell
View Dockerfile
FROM ubuntu
MAINTAINER Eitaro Fukamachi <e.arrows@gmail.com>
LABEL Description="Ubuntu with Roswell, Common Lisp implementation manager"
RUN apt-get update && apt-get install -y autotools-dev automake libcurl4-gnutls-dev curl make
RUN curl -SL https://github.com/snmsts/roswell/archive/release.tar.gz \
| tar -xzC /tmp/ \
&& cd /tmp/roswell-release \
&& sh bootstrap \
View pkcs12-experiment.lisp
(ql:quickload '(:cl+ssl :fast-io))
(in-package #:cl-user)
(defpackage #:pkcs12-experiment
(:use #:cl)
(:import-from #:cffi)
(:import-from #:cl+ssl))
(in-package #:pkcs12-experiment)
(cffi:defcfun ("EVP_PKEY_new" evp-pkey-new) :pointer)
@fukamachi
fukamachi / external-program.lisp
Created Mar 31, 2017
external-program to stream
View external-program.lisp
#+sbcl
(defun start (commands)
(check-type commands cons)
(multiple-value-bind (inputfd-shell outputfd-shell)
#+win32 (sb-win32::make-named-pipe) #-win32 (sb-posix:pipe)
(multiple-value-bind (inputfd-cl outputfd-cl)
#+win32 (sb-win32::make-named-pipe) #-win32 (sb-posix:pipe)
#+win32
(setf (sb-win32::inheritable-handle-p inputfd-cl) t
(sb-win32::inheritable-handle-p outputfd-cl) t)
@fukamachi
fukamachi / clssl.ros
Created Mar 10, 2017
Experimentation for loading CL+SSL on Windows with a custom ssleay32.dll
View clssl.ros
#!/bin/sh
#|-*- mode:lisp -*-|#
#| Experimentation for loading CL+SSL on Windows with a custom ssleay32.dll
exec ros -Q -- $0 "$@"
|#
#|
NOTE: Put ssleay32.dll at the same directory as this script.
|#
@fukamachi
fukamachi / inverse-fizzbuzz.lisp
Created May 17, 2012
Inverse FizzBuzz in Common Lisp
View inverse-fizzbuzz.lisp
;; http://www.jasq.org/2/post/2012/05/inverse-fizzbuzz.html
;; http://d.hatena.ne.jp/matarillo/20120515/p1
#.(progn
(ql:quickload :optima)
(ql:quickload :alexandria)
(ql:quickload :cl-test-more)
(values))
(setq *print-circle* t)
@fukamachi
fukamachi / which.lisp
Created Jul 4, 2015
which -- check if a command is available on the working environment
View which.lisp
(defun which (command)
(handler-case
(let* ((result (with-output-to-string (s)
(uiop:run-program `("which" ,command)
:output s
:error-output *error-output*)))
(newline-pos
(position-if (lambda (char)
(or (char= char #\Newline)
(char= char #\Return)))
@fukamachi
fukamachi / gist:4109258
Last active May 27, 2016
Pretty lambda/nil for Emacs
View gist:4109258
;; This function is quoted from this page. Thanks to Tomohiro Matsuyama.
;; http://dev.ariel-networks.com/Members/matsuyama/pretty-lambda-in-emacs/
(defun set-pretty-patterns (patterns)
(loop for (glyph . pairs) in patterns do
(loop for (regexp . major-modes) in pairs do
(loop for major-mode in major-modes do
(let ((major-mode (intern (concat (symbol-name major-mode) "-mode")))
(n (if (string-match "\\\\([^?]" regexp) 1 0)))
(font-lock-add-keywords major-mode
`((,regexp (0 (prog1 ()
You can’t perform that action at this time.