Skip to content

Instantly share code, notes, and snippets.

Alan Dipert alandipert

Block or report user

Report or block alandipert

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View llvmlisp.cpp
/* A Trivial LLVM LISP
* Copyright (C) 2008-2009 David Robillard <dave@drobilla.net>
*
* Parts from the Kaleidoscope tutorial <http://llvm.org/docs/tutorial/>
* by Chris Lattner and Erick Tryzelaar
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@micha
micha / gist:997056
Created May 28, 2011
Euler project problem #1
View gist:997056
#! /usr/bin/env racket
; Euler problem #1. Sum of integers between 1 and N which are
; divisible by i, j, k, ..., or l.
;
; The sum 1+2+3+...+n = (n^2 + n)/2, call this sum-range(n).
;
; Then the sum of i+2i+3i+...+qi = i * sum-range(floor(n/i)), where
; qi is the greatest multiple of i such that i <= n.
;
@spullara
spullara / ReflectTest.java
Created Dec 25, 2011
Invokedynamic all in one example
View ReflectTest.java
package indy;
import java.lang.invoke.CallSite;
import java.lang.invoke.ConstantCallSite;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
import java.lang.reflect.Constructor;
import org.objectweb.asm.ClassWriter;
View image.clj
;; depends on [org.imgscalr/imgscalr-lib "4.2"]
(ns XXX.image
(:refer-clojure :exclude [read])
(:require [clojure.java.io :as io])
(:import [org.imgscalr Scalr Scalr$Method Scalr$Mode]
[java.awt Image]
[java.awt.image RenderedImage BufferedImageOp]
[javax.imageio ImageIO ImageWriter ImageWriteParam IIOImage]
@jerrypnz
jerrypnz / test_watchers.clj
Created Nov 6, 2012
Clojure wrapper for Java 7 WatchService (java.nio.files)
View test_watchers.clj
(load-file "./watch_service.clj")
(refer 'watch-service)
(defn print-ev
[ev ctx]
(println "[foo]" ev " --> " ctx)
(println "Parent Dir:" (.getParent ctx)))
(defn print-ev-2
[ev ctx]
@fsmunoz
fsmunoz / abcl-mqtt.lisp
Created Jun 24, 2013
Simple example of MQTT message publish in Common Lisp and ABCL, using the Eclipse Paho client
View abcl-mqtt.lisp
;; Simple example of MQTT message publish using Common Lisp and ABCL
;;
;; Uses the Eclipse Paho client
;;
;; Author: Frederico Munoz <frederico.munoz@pt.ibm.com>
;; Date: 22-Jun-2013
;; Keywords: mqtt, messaging, m2m, telemetry, abcl, iot, paho, lisp
;;
;; Copying and distribution of this file, with or without modification,
;; are permitted in any medium without royalty provided the copyright
@kanaka
kanaka / tokenizer.sh
Last active Dec 30, 2015
bash lisp tokenizer NOTE: doesn't handle \" within strings yet
View tokenizer.sh
#!/bin/bash
wholefile=$(cat $1)
filelen=${#wholefile}
idx=0
chunk=0
chunksz=500
while true; do
if (( ${#str} < ( chunksz / 2) )) && (( chunk < filelen )); then
@DASpringate
DASpringate / cond.R
Last active May 19, 2017
A simple R implementation of `cond` from Lisp. Allows for arbitrary numbers of conditionals without nested if statements
View cond.R
#' R implementation of `cond` from Lisp
#' allows for arbitrary numbers of conditionals without ugly nested if statements
#' conditionals are entered as pairs of expressions (clauses),
#' first the expression to be evaluated and second the return value if the expression is true
#' @param ... an even number of expressions as pairs (see example)
#' @param true the `else` expression (Taken from the Lisp (T resultN) see http://www.cis.upenn.edu/~matuszek/LispText/lisp-cond.html)
#' @return The paired value of the first true conditional expression or the value of true
#' @examples
#' x <- runif(1)
#' cond(x < 0.2, "lower tail",
@josephholsten
josephholsten / sizeup.lua
Last active Mar 12, 2019
SizeUp in Hammerspoon
View sizeup.lua
-- === sizeup ===
--
-- SizeUp emulation for hammerspoon
--
-- To use, you can tweak the key bindings and the margins
local sizeup = { }
--------------
-- Bindings --
View Vagrantfile
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
$script = <<SCRIPT
apt-get install -y git maven openjdk-7-jdk
(
cd /usr/local/bin
wget https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein -O lein
chmod +x lein
)
You can’t perform that action at this time.