Skip to content

Instantly share code, notes, and snippets.

View jl2's full-sized avatar

Jeremiah LaRocco jl2

View GitHub Profile
@jl2
jl2 / svg.lisp
Last active August 29, 2015 14:02
Very rudimentary library for generating simple SVG files from Common Lisp. Handles points, lines, and polygons.
(defstruct svg
(points nil :type list)
(polys nil :type list)
(lines nil :type list))
(defstruct point
(x 0.0 :type (or float integer))
(y 0.0 :type (or float integer)))
(defstruct line
@jl2
jl2 / tsp.lisp
Last active August 29, 2015 14:03
Beginnings of a program to run approximation algorithms on instances of the traveling salesman problem.
;; (load "tsp.lisp")
(ql:quickload 'cl-ppcre)
(defstruct svg
(points nil :type list)
(polys nil :type list)
(lines nil :type list))
(defstruct point
@jl2
jl2 / updateql.lisp
Last active August 29, 2015 14:09
Update SBCL from Git
#!/usr/bin/lisp --script
#-quicklisp
(let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp"
(user-homedir-pathname))))
(when (probe-file quicklisp-init)
(load quicklisp-init)))
(ql:update-dist "quicklisp")
@jl2
jl2 / gist:d6b0f0829ee45c5e8e5f
Created November 26, 2014 01:01
updateemacs
#!/usr/bin/lisp --script
#-quicklisp
(let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp"
(user-homedir-pathname))))
(when (probe-file quicklisp-init)
(load quicklisp-init)))
(let* ((bzr-out-string (make-array '(0) :element-type 'base-char
:fill-pointer 0 :adjustable t))
@jl2
jl2 / package.lisp
Last active August 29, 2015 14:11
Association list based trie data structure in Common Lisp. Faster more memory efficient, and handles unicode better than the vector based trie I tried before.
;;;; package.lisp
(defpackage #:trie
(:use #:cl)
(:export #:create
#:add
#:contains
#:words
#:with-prefix
#:from-file
#include <iostream>
#include <chrono>
uint64_t fib(uint64_t n) {
uint64_t a=1;
uint64_t b=1;
uint64_t c = b+a;
for (uint64_t i=0; i<(n-2); ++i) {
c = b + a;
b = a;
60.times{|a|puts (0..240).map{|b|x=i=0;x=x*x+Complex(b/4.0-45,a-30)/30until x.abs>4||99<i+=1;i>99?'#':'.'}*''}
#!/usr/bin/ruby
require 'nokogiri'
require 'open-uri'
# Handle command line
account = ARGV.shift || 'jl_2'
num = ARGV.shift || 10
if num.to_i > 200
puts "Can only fetch up to 200 tweets at a time."
#!/usr/bin/python
# pyget.py
# Copyright (c) 2010, Jeremiah LaRocco jeremiah.larocco@gmail.com
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#!/usr/bin/perl
# select_demo.pl
# Copyright (c) 2010, Jeremiah LaRocco jeremiah.larocco@gmail.com
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.