Instantly share code, notes, and snippets.

View hello.scm
;;; CK machine
;;; For detail, see http://okmij.org/ftp/Scheme/macros.html#ck-macros
(define-syntax ck
(syntax-rules (quote)
((_ () 'v) 'v)
((_ (((op ...) ea ...) . s) 'v)
(ck s "arg" (op ... 'v) ea ...))
((_ s "arg" (op va ...))
(op s va ...))
((_ s "arg" (op ...) 'v ea1 ...)
View nbe.lisp
;; Intentional normalization by evaluation for untyped lambda caluclus
;; Based on Sam Lindley's talk at metaprog2016
;; http://homepages.inf.ed.ac.uk/slindley/nbe/nbe-cambridge2016.pdf
;; object lang
;; M ::= x
;; | (fn x M)
;; | (M N)
(defun econs (key val env)
View laterminal.js
var s = WScript.CreateObject("WScript.Shell");
s.run("bash -i -c \"cd; lxterminal\"", 0)
View a.java
import java.util.*;
import java.lang.*;
public class Main {
static int doit(String ps, int fsiz) {
int len = ps.length();
boolean bs[] = new boolean[len];
for (int i = 0; i < len; i++) {
bs[i] = ((ps.charAt(i) == '+')?true:false);
View dozens_dns_update.rb
require 'dozens'
require 'resolv'
user = 'hoge'
apikey = 'fuga'
def update_a(domain, sub)
if sub == "" then
whole = domain
else
View ck-addsub.scm
(define-syntax ck
(syntax-rules (quote)
((_ () 'v) 'v)
((_ (((op ...) ea ...) . s) 'v)
(ck s "arg" (op ... 'v) ea ...))
((_ s "arg" (op va ...))
(op s va ...))
((_ s "arg" (op ...) 'v ea1 ...)
(ck s "arg" (op ... 'v) ea1 ...))
((_ s "arg" (op ...) ea ea1 ...)
View atcoder.lisp
(eval-when (:compile-toplevel :load-toplevel :execute)
(defun script-p ()
(eql sb-sys:*stdin* *standard-input*)) )
(macrolet ((optimize (pred)
(if pred
`(declaim (optimize (speed 3) (debug 0) (safety 0)))
`(declaim (optimize (speed 0) (debug 3) (safety 3))))))
(optimize #.(script-p)))
View warshall-floyd.lisp
(defun warshall-floyd (n edges)
(let ((table (make-array (list n n) :initial-element 0)))
(dolist (x edges)
(destructuring-bind (from to weight) x
(setf (aref table from to) weight)))
(dotimes (k n)
(dotimes (i n)
(dotimes (j n)
(when (> (aref table i j)
(+ (aref table i k) (aref table k j)))
View webdav
server {
listen 80;
server_name dav.pohe;
location / {
root /var/www/webdav;
auth_basic "pohe!";
auth_basic_user_file /etc/nginx/conf.d/.htpasswd;
View build.sbt
lazy val root = (project in file(".")).settings(
name := "sdramtest",
version := "0.1.0",
scalaVersion := "2.11.7"
).dependsOn(
ProjectRef(uri("git://github.com/wasabiz/chisel-uart.git"), "chisel-uart"),
ProjectRef(uri("git://github.com/zeptometer/chisel-DE1-SDRAM.git"), "chisel-de1-sdram"))
libraryDependencies += "edu.berkeley.cs" %% "chisel" % "latest.release"