Skip to content

Instantly share code, notes, and snippets.

@gwerbin
gwerbin / conda_env_export.py
Created Jan 8, 2021
Export a Conda environment with --from-history, but also append Pip-installed dependencies
View conda_env_export.py
"""
Export a Conda environment with --from-history, but also append
Pip-installed dependencies
Exports only manually-installed dependencies, excluding build versions, but
including Pip-installed dependencies.
Lots of issues requesting this functionality in the Conda issue tracker, no
sign of progress (as of March 2020).
View gitpath.zsh
# TODO: should this have a --flag for dispatch to system/global/local? Currently only supports local.
function gitpath() {
local git_dir output_path
if [[ -z "$GIT_DIR" ]]; then
read -r -d '' git_dir < <(git rev-parse --show-toplevel)
git_dir="${git_dir}/.git"
else
git_dir="$GIT_DIR"
@gwerbin
gwerbin / NHST.md
Created Aug 27, 2020
NHST draft writeup
View NHST.md

Null Hypothesis Significance Testing (NHST) is a procedure in which we try to learn something about the data by forming an hypothesis and then ruling out (or "rejecting) that hypothesis. Conceptually, NHST is similar to "deductive reasoning" in philosophy, or "differential diagnosis" in medicine: we can arrive on a single unambiguous conclusion only by ruling out all other possibilities. Therefore we can "prove" that the alternative hypothesis is true by ruling out the only other possibility, the null hypothesis.

In order to perform NHST, have to specify a null hypothesis, typically denoted H0, and an alternative hypothesis, typically denoted HA. H0 and HA must be mutually exclusive for NHST to make sense: if H0 is true then HA must be false, and if HA is true then H0 must be false.

NHST has two possible outcomes: we reject the null hypothesis in favor of the alternative hypothesis, or we fail to reject the null hypothesis. Failing to reject the null hypothesis does not mean that we reject

@gwerbin
gwerbin / writeup.md
Last active Aug 8, 2020
My attempt to understand Sans I/O style.
View writeup.md

My attempt to understand Sans IO

The basic machinery is:

  1. An Event type
  2. A Client that receives "inbound events" (responses from previous i/o) and emits "outbound events"; one core implementation
  3. An IOClient that performs i/o based on outbound events and forms inbound events from i/o results; one implementation per i/o framework

Hypothetical implementations

@gwerbin
gwerbin / # openssl@1.1 - 2020-05-07_11-46-25.txt
Created May 7, 2020
openssl@1.1 on 3.10.0-1062.12.1.el7.x86_64 - Homebrew build logs
View # openssl@1.1 - 2020-05-07_11-46-25.txt
Homebrew build logs for openssl@1.1 on 3.10.0-1062.12.1.el7.x86_64
Build date: 2020-05-07 11:46:25
@gwerbin
gwerbin / kmscon-install.sh
Last active Apr 23, 2020
Build KMSCon on Linux Mint 19.3
View kmscon-install.sh
#!/bin/sh
uname -a | grep --quiet 'Debian\|Ubuntu' || {
echo 'Refusing to run on a potentially incompatible system.'
return 1
}
# Build dependencies
sudo apt install \
autoconf \
View kbdpad_mk2.json
{
"name": "KBDPAD-MKII",
"vendorId": "0xA103",
"productId": "0x0006",
"lighting": "qmk_backlight_rgblight",
"matrix": {
"rows": 6,
"cols": 4
},
"layouts": {
View classif-sim.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View lrml_torch.py
import sys
from time import perf_counter
import numpy as np
import torch
import torch.nn.functional as F
from sklearn.datasets import make_classification
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelBinarizer
from tqdm import tqdm
@gwerbin
gwerbin / sparse_column_indices.py
Created Sep 26, 2019
Get the column indices out of a sparse array
View sparse_column_indices.py
import numpy as np
from scipy import sparse
x = np.array([
[1, 0, 1],
[0, 0, 1],
[1, 1, 0],
[0, 1, 1]
])