Skip to content

Instantly share code, notes, and snippets.

@pao
pao / iface_test.jl
Created April 20, 2012 23:10
Julia interfaces prototype
load("interface.jl")
type Blah; end
type Bluh; end
@interface FooBar{T} [
(:foo, :(T, Integer,))
(:bar, :(T, String, Integer))
]
@pao
pao / monads.md
Last active July 29, 2019 15:15
Work in progress overkill solution to final 7L7W exercise
@pao
pao / gist:5188ce10bfcbcd95f664c85ec88f4b08
Created February 22, 2017 23:32
Penrose Rhombs.ipynb
{
"cells": [
{
"cell_type": "code",
"execution_count": 110,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
@pao
pao / config.el
Last active November 16, 2016 11:09
One of my config.el files...
(setq w32-get-true-file-attributes nil)
(add-to-list 'load-path
(concat user-emacs-directory
(convert-standard-filename "personal/modules")))
(prelude-require-packages
'(nyan-mode
ag
clang-format
@pao
pao / gist:8072640
Created December 21, 2013 17:58
Sample log output from a DumbBot instance
(dumbirc) PS C:\Users\patrick\dumbirc\src> python ..\Scripts\twistd.py -noy dumbirc.tac
2013-12-21 11:46:39-0600 [-] Log opened.
2013-12-21 11:46:39-0600 [-] twistd 13.2.0 (C:\Users\patrick\dumbirc\Scripts\python.exe 2.7.3) starting up.
2013-12-21 11:46:39-0600 [-] reactor class: twisted.internet.selectreactor.SelectReactor.
2013-12-21 11:46:39-0600 [-] Starting factory <dumbbot.DumbIRCFactory instance at 0x02C8C4E0>
2013-12-21 11:46:39-0600 [-] Starting factory <dumbbot.DumbIRCFactory instance at 0x02D29350>
2013-12-21 11:46:39-0600 [-] Starting factory <dumbbot.DumbIRCFactory instance at 0x02D293A0>
2013-12-21 11:46:39-0600 [Uninitialized] connectionMade
2013-12-21 11:46:39-0600 [Uninitialized] connectionMade
2013-12-21 11:46:39-0600 [DumbBot,client] signed on; joining channel #desertbus
@pao
pao / cm-ec2-init.sh
Created November 20, 2010 00:23
Scripts to get and manage CyanogenMOD on an Amazon EC2 instance
#!/bin/bash
# wget https://gist.github.com/raw/707468/cm-ec2-init.sh && . cm-ec2-init.sh
# Epic CM-on-EC2 Init Script for ami-4a0df923
# Preemptively agree to the JDK license
echo "sun-java6-bin shared/accepted-sun-dlj-v1-1 boolean true" | sudo debconf-set-selections
# Get required packages
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo aptitude update
@pao
pao / requirements.txt
Created May 27, 2013 18:05
JuliaDoc requirements.txt file.
-e git+https://github.com/JuliaLang/JuliaDoc.git#egg=JuliaDoc
@pao
pao / Code-Patterns.md
Created February 11, 2013 19:31
Former contents of Julia wiki page on code patterns.

Code Patterns in Julia

Climbing the type hierarchy

The base library of Julia contains a method which finds the element type of an array. This dispatch is fine for instances of AbstractArray or any of its children.

eltype{T,n}(::AbstractArray{T,n}) = T
@pao
pao / qc.md
Last active October 11, 2015 10:17
An in-development Julia implementation of QuickCheck

Now being developed at https://github.com/pao/QuickCheck.jl and available via Pkg as "QuickCheck".

Package documentation is at https://quickcheckjl.rtfd.org/.

# A Julia implementation of QuickCheck, a randomized specification-based tester
#
# QuickCheck was originally written for Haskell by Koen Claessen and John Hughes
# http://www.cse.chalmers.se/~rjmh/QuickCheck/
@pao
pao / ccall_wrapper.jl
Created September 19, 2012 12:46 — forked from dcampbell24/gist:3470851
julia ccall macro
macro ccallWrap(lib, fnSym, retType, argTypes)
args = [gensym() for i in 1:length(argTypes.args)]
fnArgs = [:($(args[i])::$(argTypes[i]))
for i in 1:length(argTypes)]
:(($fnSym)($fnArgs...) = ccall(dlsym($lib, $fnSym), $retType, $argTypes, $args...))
end