Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 dataclasses | |
import functools | |
import typing as t | |
import chex | |
import distrax | |
import gym | |
import haiku as hk | |
import jax | |
import jax.numpy as jnp |
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 dataclasses | |
from typing import Iterable, Optional, Protocol, Tuple | |
import numpy as np | |
Array = np.ndarray | |
@dataclasses.dataclass(frozen=True) |
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 typing import Dict, Tuple | |
import numpy as np | |
from matplotlib import colors as mc | |
from matplotlib import pyplot as plt | |
def _make_colormap(colors: Dict[int, str], name: str) -> mc.LinearSegmentedColormap: | |
z = np.sort(list(colors.keys())) | |
min_z = min(z) |
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 matplotlib import pyplot as plt | |
import numpy as np | |
from scipy.stats import beta | |
def plot_beta(a, b): | |
x = np.linspace(beta.ppf(0.01, a, b), beta.ppf(0.99, a, b), 100) | |
plt.plot(x, beta.pdf(x, a, b), 'r-', lw=5, alpha=0.6, label='beta pdf') | |
plt.title('α={} β={}'.format(a, b)) | |
plt.show() |
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
;;; init.el --- init file if Emacs | |
;;; Commentary: | |
;;; Code: | |
(package-initialize) | |
(setq package-archives | |
'(("gnu" . "http://elpa.gnu.org/packages/") | |
("melpa" . "http://melpa.org/packages/") | |
("org" . "http://orgmode.org/elpa/"))) |
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
require 'json' | |
require 'net/http' | |
require 'open3' | |
require 'optparse' | |
require 'pathname' | |
require 'rbconfig' | |
require 'tempfile' | |
require 'uri' | |
TEST_CASE_MAX = 120 |
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 re | |
from xkeysnail.transform import * | |
# Emacs-like keybindings in non-Emacs applications | |
define_keymap(re.compile("Firefox"), { | |
# Ctrl+Alt+j/k to switch next/previous tab | |
K("Caps-M-j"): K("C-TAB"), | |
K("Caps-M-k"): K("C-Shift-TAB"), | |
# Type Caps-j to focus to the content | |
K("Caps-j"): K("C-f6"), |
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
function luatex-make | |
set name (string split . $argv[1])[1] | |
if [ 2 = (count $argv) ] | |
set bib (string split . $argv[2])[1] | |
else | |
set bib $name | |
end | |
lualatex $name | |
biber $bib | |
lualatex $name |
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
function venv | |
if mkdir $argv ^/dev/null | |
virtualenv --system-site-packages -p python3 $argv | |
. ./$argv/bin/activate.fish | |
else | |
. ./$argv/bin/activate.fish | |
end | |
end |
NewerOlder