Skip to content

Instantly share code, notes, and snippets.

@GOFAI
GOFAI / scenekit-demo.lisp
Last active May 4, 2021 23:41
Basic SceneKit demo in Common Lisp using CCL's ObjC bridge
(objc:load-framework "SceneKit" :scenekit)
(defpackage :scenekit-demo)
(in-package :scenekit-demo)
(defun make-scenekit-view (window)
(let* ((view (#/alloc ns:s-c-n-view))
(scene (#/scene ns:s-c-n-scene))
;;; for some reason #/rootNode is unbound, but this works:
@GOFAI
GOFAI / cocoa-gears-demo.lisp
Last active October 16, 2017 06:26
Implementation of Legacy OpenGL Demo "gears.c" for OSX Cocoa using Clozure Common Lisp ObjC Bridge
(defpackage :opengl-gears-demo)
(in-package :opengl-gears-demo)
(require 'cl-opengl)
(require 'cl-glu)
;;; needed to run at full resolution in Retina display
(objc:defmethod (#/setWantsBestResolutionOpenGLSurface: :void)
((self ns:ns-object) (value :<BOOL>)))
@GOFAI
GOFAI / color-triangle-demo.lisp
Created October 16, 2017 06:18
Example of OpenGL 4.1 in Cocoa in Clozure Common Lisp using ObjC Bridge
(defpackage :color-triangle-demo)
(in-package :color-triangle-demo)
(require 'cl-opengl)
(require 'cl-glu)
;;; needed to run at full resolution in Retina display
(objc:defmethod (#/setWantsBestResolutionOpenGLSurface: :void)
((self ns:ns-object) (value :<BOOL>)))
@GOFAI
GOFAI / dl4j-mnist.lisp
Created May 6, 2017 06:18
DL4J MLPMnistSingleLayerExample with ABCL and JSS
(in-package :asdf)
(defsystem :dl4j :defsystem-depends-on (:abcl-asdf)
:components ((:mvn "org.deeplearning4j/deeplearning4j-core" :version "0.8.0")
(:mvn "org.nd4j/nd4j-native" :version "0.8.0")))
(asdf:load-system :dl4j)
(in-package :jss)
@GOFAI
GOFAI / wseg10.py
Created April 28, 2016 03:45
Python implementation of WSEG-10 fallout model
import numpy as np
from scipy.special import gamma
from scipy.stats import norm
from affine import Affine
# WSEG-10 fallout model as described in Dan W. Hanifen, "Documentation and Analysis
# of the WSEG-10 Fallout Prediction Model," Thesis, Air Force Institute of Technology,
# March 1980.
class WSEG10:
@GOFAI
GOFAI / sudoku.lisp
Last active February 26, 2016 07:10
Common Lisp sudoku solver using ITERATE
(defpackage sudoku
(:use #:cl #:iterate))
(in-package #:sudoku)
(defun sd-block (n l)
(let ((start (nth n '(0 3 6 27 30 33 54 57 60)))) ; lookup is faster
(iter (for b on (nthcdr start l) by #'(lambda (p) (nthcdr 9 p)))
(for line from 1 to 3)
(appending (subseq b 0 3)))))
@GOFAI
GOFAI / rainout.f
Last active December 7, 2015 05:55
Old FORTRAN program for estimating worst-case rainout hazards from low-yield tactical nuclear weapons
**************************************************************************
* *
* RAINOUT MODEL *
* *
* This program computes the maximum dose rate. in Rads per hour, *
* produced by a nuclear air burst. The nuclear cloud is washed out by a *
* simulated rain storm at a specified time t of cloud washout. The *
* activity grounded as a result of the radioactive cloud washout, *
* A(x,y,t), is used to compute the dose rate. This program will accomo- *
* date changes in the following Input parameters: particle size dist- *
@GOFAI
GOFAI / dungeon.rb
Created December 4, 2015 09:07
Homebrew formula to install DUNGEON 4.0
class Dungeon < Formula
desc "the classic text adventure"
homepage "https://github.com/GOFAI/dungeon"
url "https://github.com/GOFAI/dungeon/archive/4.0.tar.gz"
sha256 "be2217be9e23861f22c14c4395da272fca5fb08a1741f52fd393792908279bea"
depends_on :fortran
def install
chdir "src" do
@GOFAI
GOFAI / makefile
Created November 26, 2015 08:28
makefile to build clasp on osx using homebrew dependencies
# -*- mode: GNUmakefile; indent-tabs-mode: t -*-
# Cleaned up by Shinmera October 13, 2015
export CLASP_HOME := $(or $(wildcard $(CLASP_HOME)),\
$(shell pwd))
include $(wildcard $(CLASP_HOME)/local.config)
export PJOBS ?= 1
@GOFAI
GOFAI / deepcl.rb
Created November 22, 2015 03:13
Finalized Homebrew Formula for DeepCL
class Deepcl < Formula
desc "OpenCL library to train deep convolutional neural networks"
homepage "https://github.com/hughperkins/DeepCL"
url "https://github.com/hughperkins/DeepCL/archive/v8.1.3.tar.gz"
sha256 "e0301ba5ae4464ae27a3ec2c777b77faa90b9ee6d1059b200f06a9100d182de1"
resource "EasyCL" do
url "https://github.com/hughperkins/EasyCL/archive/b9023cdf25c10524ad06227275d3756bbe0c0ed2.tar.gz"
sha256 "96c6061385e850081cfce17673353b41dbf470fc6b6f3a15e047b1d6506ba80e"
end