Skip to content

Instantly share code, notes, and snippets.

@fukamachi
fukamachi / using-travis-ci-with-roswell.md
Last active May 28, 2021 03:36
Using Travis CI with Roswell

Using Travis CI with Roswell

Travis CI is the most prevalent cloud CI service. Though it has no Common Lisp support officially, by using Roswell, you can test your Common Lisp product with a few efforts.

WARNING: This document is based on Roswell v0.0.3.42 (not released yet) or above.

Enabling Travis CI

To use Travis CI, you must sign up and enable testing for your repository at your profile page.

@fukamachi
fukamachi / common-lisp-scripting-with-roswell.md
Last active April 10, 2021 16:39
Common Lisp Scripting with Roswell (Draft)

Common Lisp Scripting with Roswell

"Roswell Script" is implementation-independent Common Lisp scripting program which uses Roswell. Although Roswell itself is a unified interface to Common Lisp implementations, it also encourages writing scripts with it.

To start writing it, run ros init in your terminal:

$ ros init
Usage: ros init [template] name [options...]
require "formula"
class Chasen < Formula
homepage "http://chasen-legacy.osdn.jp"
url "http://iij.dl.osdn.jp/chasen-legacy/56305/chasen-2.4.5.tar.gz"
sha256 "fd1a7afd73ed14e18b0fe82965c00a6baae383070360a4220fde01338611416a"
head "git://git.osdn.jp/gitroot/chasen-legacy/chasen.git"
def install
@fukamachi
fukamachi / hubotify.ros
Created December 24, 2015 14:35
Generate a Hubot script (.js file) from the given Roswell script.
#|-*- mode:lisp -*-|#
#|
exec ros -Q -- $0 "$@"
|#
#|
Generate a Hubot script (.js file) from the given Roswell script.
Usage:
$ hubotify <roswell script>
@fukamachi
fukamachi / clssl.ros
Created March 10, 2017 10:01
Experimentation for loading CL+SSL on Windows with a custom ssleay32.dll
#!/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 / external-program.lisp
Created March 31, 2017 01:44
external-program to stream
#+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)
(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 / lock-pool
Created October 14, 2017 06:50
Lock to allow n times to acquire
(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 / fntype-annot.lisp
Created June 24, 2018 15:07
Type annotation for functions in Common Lisp
(annot:defannotation fntype (args result form)
(:arity 3)
(let* ((last-form (cl-annot.util:progn-form-last form))
(symbol (cl-annot.util:definition-form-symbol last-form)))
`(progn (declaim (ftype (function ,args ,result) ,symbol))
,form)))
;; Usage:
;; (ql:quickload :cl-syntax)
;; (syntax:use-syntax :annot)
@fukamachi
fukamachi / keys.lisp
Created August 17, 2018 04:47
Generating RSA key pairs in DER format
(in-package :cl-user)
(ql:quickload '(:ironclad :asn1))
(defun generate-rsa-key-pair (num-bits)
"Same as (ironclad:generate-key-pair :rsa :num-bits num-bits) except returning in DER format."
(check-type num-bits integer)
(let ((l (floor num-bits 2)))
(multiple-value-bind (p q n)
(loop for a = (ironclad:generate-prime (- num-bits l))