Skip to content

Instantly share code, notes, and snippets.

@skaslev
skaslev / NatInd.idr
Created September 18, 2016 19:45 — forked from david-christiansen/NatInd.idr
Simple proof automation with reflected elaboration
module NatInd
import Language.Reflection.Elab
import Language.Reflection.Utils
%default total
trivial : Elab ()
trivial = do compute
g <- snd <$> getGoal
@skaslev
skaslev / pearcy.py
Created September 14, 2016 12:22 — forked from anonymous/pearcy.py
Compute and plot Pearcey integral
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import scipy.integrate as integrate
# Dimension of image in pixels
N = 256
# Number of samples to use for integration
M = 32
@skaslev
skaslev / after.agda
Created July 28, 2016 05:56 — forked from mbrcknl/after.agda
Code from BFPG talk about dependent types in Agda
-- Matthew Brecknell @mbrcknl
-- BFPG.org, March-April 2015
-- With thanks to Conor McBride (@pigworker) for his lecture series:
-- https://www.youtube.com/playlist?list=PL44F162A8B8CB7C87
-- from which I learned most of what I know about Agda, and
-- from which I stole several ideas for this talk.
open import Agda.Primitive using (_⊔_)
@skaslev
skaslev / pg-pong.py
Created June 29, 2016 16:14 — forked from karpathy/pg-pong.py
Training a Neural Network ATARI Pong agent with Policy Gradients from raw pixels
""" Trains an agent with (stochastic) Policy Gradients on Pong. Uses OpenAI Gym. """
import numpy as np
import cPickle as pickle
import gym
# hyperparameters
H = 200 # number of hidden layer neurons
batch_size = 10 # every how many episodes to do a param update?
learning_rate = 1e-4
gamma = 0.99 # discount factor for reward
@skaslev
skaslev / sudo.py
Created April 15, 2016 09:00 — forked from barneygale/sudo.py
import sys, marshal, functools, subprocess
child_script = """
import marshal, sys, types;
fn, args, kwargs = marshal.load(sys.stdin)
marshal.dump(
types.FunctionType(fn, globals())(*args, **kwargs),
sys.stdout)
"""
@skaslev
skaslev / quasicrystal.py
Created March 15, 2016 13:01 — forked from omegahm/quasicrystal.py
Quasicrystals in Python
# -*- coding: utf-8 -*-
import bohrium as np
from math import pi
import matplotlib.pyplot as plt
import matplotlib.colors as colors
fig = plt.figure()
plt.xticks([])
plt.yticks([])
@skaslev
skaslev / RigidbodyMassCalculator.cs
Created January 5, 2016 12:27 — forked from FreyaHolmer/RigidbodyMassCalculator.cs
Used to approximate a proper mass value for all the colliders in a given Rigidbody
using UnityEngine;
using System.Linq;
[RequireComponent(typeof(Rigidbody))]
public class RigidbodyMassCalculator : MonoBehaviour {
public float density = 1f;
public bool recalculateOnAwake = true;
Rigidbody rb;