This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /usr/bin/env python | |
| ''' | |
| Simple example demonstrating how to take a screenshot | |
| ''' | |
| import time | |
| import sys | |
| import os | |
| import argparse | |
| #OpenGL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| A perl Data.Dumper clone for Python | |
| Author: simon@log4think.com | |
| 2011-07-08 | |
| """ | |
| #!/bin/env python | |
| import sys | |
| from types import * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- 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] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| import gym | |
| import numpy as np | |
| import tensorflow as tf | |
| class PolicyGradientAgent(object): | |
| def __init__(self, hparams, sess): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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: |
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (* 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]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import torch | |
| import toolz | |
| def kalman (b, # # rows, cols, in Z; # rows in z | |
| n, # # rows, cols, in P; # rows in x | |
| Z, # b x b observation covariance | |
| x, # n x 1, current state | |
| P, # n x n, current covariance | |
| A, # b x n, current observation partials |