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 csv | |
import math | |
import matplotlib.pyplot as plt | |
import locale | |
def frac(x): | |
return x - math.floor(x) | |
def first_digit(x): | |
return int(math.floor(math.pow(10, frac(math.log10(x))) + 0.0001)) |
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
# Python 3 | |
import collections | |
Write = collections.namedtuple("Write", ["written"]) | |
def hello_world(): | |
yield Write("Hello, world!") | |
yield Write("Hello, world!") | |
return 1 | |
def identity(gen): |
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
/* | |
* This is a literate quine. That means that | |
* 1. the comments will tell you a little about how it works and | |
* 2. if you compile and run it its output will be identical to its source | |
* code even though it doesn't look at its original source. It literally | |
* contains within itself a complete recipe for how to display itself. | |
* | |
* Quines are ten a penny. This one is unusual because | |
* 1. its main loop consists solely of a loop to print characters | |
* generated by a function called programChar() and |
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 short exact sequence is a sequence of maps: | |
f g h k | |
0 --> A --> B --> C --> 0 | |
s.t. | |
Im f = Ker g | |
Im g = Ker h | |
Im h = Ker k | |
Example: |
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
`RUN` to assemble | |
`GOTO s` to start it |
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
<html> | |
<body> | |
<button type="button" id="start"> | |
Switch me on to start | |
</button> | |
<HR> | |
<div> |
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
from __future__ import print_function | |
import sys | |
# If you don't know jax, check it out | |
# https://github.com/google/jax | |
import jax.numpy as np | |
import jax.scipy as scipy | |
from jax import jit, random, value_and_grad |
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
> scale :: Num a => a -> [a] -> [a] | |
> scale a bs = map (a *) bs | |
Invert an infinite upper triangular matrix with 1 on diagonal | |
[ | |
[1, b₀₁, b₀₂, b₀₃, …], | |
[1, b₁₂, b₁₃, …], | |
[1, b₂₃, …], | |
… | |
] |
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
# Trying to get a handle on "Deep Image Prior" | |
# at https://dmitryulyanov.github.io/deep_image_prior | |
# This is a toy version with a single purely linear | |
# convolution layer | |
# The goal is to start with an image with high res detail, | |
# corrupt a few bits, and then | |
# repair the corrupt bits using an a priori model | |
# that simply says "we can make the image from a lower resolution |
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
This code can be used to model very unlikely disruptions to your code, | |
eg. hits by cosmic rays. | |
This is the cosmic ray monad: | |
> data Cosmic a = Cosmic { central::a, side::[a] } deriving Show | |
Cosmic a b is considered equal to Cosmic a' b' if | |
a==a' and b is a permutation of b'. |