Skip to content

Instantly share code, notes, and snippets.

;;; -*- Package: User; Syntax: Common-Lisp; Mode: Lisp; Base: 10 -*-
;;; unify.lisp
(in-package "USER")
;;; ****************************************************************
;;; Unification Algorithm ******************************************
;;; ****************************************************************
;;;
;;; Random implementations of unification.
;;
;; SELECT-MATCH macro (and IN macro)
;;
;; Copyright 1990 Stephen Adams
;;
;; You are free to copy, distribute and make derivative works of this
;; source provided that this copyright notice is displayed near the
;; beginning of the file. No liability is accepted for the
;; correctness or performance of the code. If you modify the code
;; please indicate this fact both at the place of modification and in
@cemerick
cemerick / gist:1452640
Created December 9, 2011 18:05
dependency-tree for Leiningen
;; requires [com.cemerick/pomegranate "0.0.2"]
;; i.e. https://github.com/cemerick/pomegranate
(use '[cemerick.pomegranate.aether :only (dependency-hierarchy resolve-dependencies)])
=> (pprint
(dependency-hierarchy
'[[incanter "1.2.3"]]
(resolve-dependencies {:coordinates '[[incanter "1.2.3"]]
:repositories (merge cemerick.pomegranate.aether/maven-central {"clojars" "http://clojars.org/repo"})})))
@onote2
onote2 / HelloYesod.hs
Created December 11, 2011 11:53
HelloWorld in Yesod
{-# LANGUAGE TypeFamilies, QuasiQuotes, MultiParamTypeClasses, TemplateHaskell, OverloadedStrings #-}
import Yesod
-- Versions installed: 0.9.3.4
data HelloWorld = HelloWorld
mkYesod "HelloWorld" [parseRoutes|
/ HomeR GET
|]
@brool
brool / yvfc.py
Created January 26, 2012 00:08
Statementless Python -- originally at http://www.pick.ucam.org/~ptc24/yvfc.html
#!/usr/bin/env python
# Look! It's Statementless Python
# Copyright Peter Corbett 2005
# NO WARRANTY: If you use this for anything important, you're mad!
# Credits to: Ian Jackson for having the idea, Ken Slonneger for
# "Syntax and Semantics of Programming Languages" (large parts this program
# were hand-translated from one of the examples), and fanf, with whom I
# cannot hope to compete.
# Unlike most Python programs, whitespace matters little here. It could
# be a one-liner if you had a monitor long enough.
@dakrone
dakrone / project.clj
Created February 16, 2012 18:01
lein-multi functionality with lein ver.2 profiles
∴ lein2 all test
Performing task 'test' with profile(s): 'dev,1.2'
Testing clj-http.test.client
Testing clj-http.test.cookies
Testing clj-http.test.core
Ran 47 tests containing 175 assertions.
Security Alert - Please reset your npm registry account
==================================================
The security of the npm registry has just been upgraded. This corrects a known
flaw which led to the leakage of the password_sha and salt fields. The good
news is that the leak is plugged. The bad news is that it existed for quite a
while.
tl;dr
@stuarthalloway
stuarthalloway / gist:2002582
Created March 8, 2012 18:39
Datomic extent query
;; Datomic example code
;;
;; The extent of entity ?x is all datoms that are about ?x.
;; Drop this into your rules.
;;
;; Demonstrates
;;
;; 1. recursive query (extent calls itself)
;; 2. disjunction (different extent bodies are ORed)
;; 3. component attributes (e.g. your arm is a component, your brother isn't)
@Chouser
Chouser / gmail.clj
Created March 24, 2012 18:18
Send email via gmail from Clojure
(ns foo
(:import (java.util Properties)
javax.mail.internet.MimeMessage
(javax.mail.internet MimeMessage InternetAddress)
(javax.mail Session Transport Authenticator
PasswordAuthentication Message$RecipientType)))
(defn send-gmail [{:keys [from to subject text user password]}]
(let [auth (proxy [Authenticator] []
(getPasswordAuthentication []
@swannodette
swannodette / spectral_norm.cljs
Last active October 3, 2015 00:37
spectral_norm_alioth.js
function A(i,j) {
return 1/((i+j)*(i+j+1)/2+i+1);
}
function Au(u,v) {
for (var i=0; i<u.length; ++i) {
var t = 0;
for (var j=0; j<u.length; ++j)
t += A(i,j) * u[j];
v[i] = t;