Skip to content

Instantly share code, notes, and snippets.

View rebcabin's full-sized avatar

Brian Beckman rebcabin

View GitHub Profile
@rebcabin
rebcabin / practice.wl
Created August 25, 2019 00:57
Practice cards from "Refresher Course in Gregg Shorthand, Diamond Jubilee Series" in wolframscript.
(* Load this file into a wolframscript session with << "practice.wl",
then call getRandomCardWords[] repeatedly until tired. Write out
the resulting words in Gregg, then check against the cited page
number and first line number in the book. *)
ClearAll[header];
header=
{ 0 , "cd" , "pg" , "chp" , "sec" , "num" , "a" , "b" , "c" , "d" , "e" , "f" };
ClearAll[cards];
@rebcabin
rebcabin / GPLv3.md
Created September 10, 2018 01:19 — forked from kn9ts/GPLv3.md
GPLv3 explained

GPL3 LICENSE SYNOPSIS

TL;DR* Here's what the license entails:

1. Anyone can copy, modify and distribute this software.
2. You have to include the license and copyright notice with each and every distribution.
3. You can use this software privately.
4. You can use this software for commercial purposes.
5. If you dare build your business solely from this code, you risk open-sourcing the whole code base.
@rebcabin
rebcabin / units_strategy.py
Created April 23, 2018 12:14
Hypothesis strategy for random units expressions
import hypothesis.strategies as s
from support.UnitRegistry import units, Q
from pint import UnitRegistry
from pint.errors import UndefinedUnitError
from pprint import PrettyPrinter
pp = PrettyPrinter(indent=2)
def _in_unit_registry(u: str, ureg: UnitRegistry) -> bool:
try:
@rebcabin
rebcabin / mathtest.md
Created April 3, 2018 17:52
Do we render mathjax yet?

$x = \sqrt{y}$

@rebcabin
rebcabin / cartpole_pg.py
Created January 29, 2018 05:24 — forked from shanest/cartpole_pg.py
Policy gradients for reinforcement learning in TensorFlow (OpenAI gym CartPole environment)
#!/usr/bin/env python
import gym
import numpy as np
import tensorflow as tf
class PolicyGradientAgent(object):
def __init__(self, hparams, sess):
@rebcabin
rebcabin / McBridePatersonSequenceApTypes.hs
Created January 18, 2018 01:39
Type analysis for McBride's and Paterson's definition of sequence in terms of ap.
-- See [McBride & Paterson, Applicative Programming with Effects]
-- (www.staff.city.ac.uk/~ross/papers/Applicative.html)
{-
Analysis of types:
Following, from the paper, the definition of `sequence` in terms of `ap` from
`Control.Monad`:
sequence :: [IO a] -> IO [a]
@rebcabin
rebcabin / CompositionsOfCompositions.txt
Last active December 14, 2019 01:25
Compositions of compositions in Haskell, pursuant to https://github.com/ekmett/lens/wiki/Derivation
In https://github.com/ekmett/lens/wiki/Derivation, we see some types for
composition of compositions: (.).(.), (.).(.).(.), and so on. Let's prove that
the type of (.).(.) is (a -> b) -> (c -> d -> a) -> c -> d -> b, as stated in
the site. We'll stick with prefix notation, meaning that we want the type of
(.)(.)(.).
Recall the type of composition. This should be intuitive:
(.) :: (b -> c) -> (a -> b) -> a -> c [1]
@rebcabin
rebcabin / Dumper.py
Created November 25, 2017 15:21 — forked from passos/Dumper.py
A perl Data.Dumper clone for Python
"""
A perl Data.Dumper clone for Python
Author: simon@log4think.com
2011-07-08
"""
#!/bin/env python
import sys
from types import *
@rebcabin
rebcabin / screenshotty.py
Created October 27, 2017 18:35 — forked from Jerdak/screenshotty.py
OpenGL screenshots using python
#! /usr/bin/env python
'''
Simple example demonstrating how to take a screenshot
'''
import time
import sys
import os
import argparse
#OpenGL
@rebcabin
rebcabin / KeplerLagrangian.wl
Last active September 6, 2017 00:07
Kepler Problem, Lagrangian form
ClearAll[toSI];
toSI[magn_, unit_] :=
UnitConvert[Quantity[magn, unit]] // QuantityMagnitude;
<< NumericalCalculus`
ClearAll[r, \[Theta], \[Tau], realizer, G, mE, mS, M, \[Mu],
dES, \[Theta]dot00, day];
realizer = {G -> toSI[6.67408 10^-11, "m^3/kg/s^2"],
mE -> QuantityMagnitude[
UnitConvert[
Entity["Planet", "Earth"][EntityProperty["Planet", "Mass"]]]],