start new:
tmux
start new with session name:
tmux new -s myname
#!/bin/sh | |
# Configure the following default variables according to your requirements | |
language="en-US" # e.g. "de" or "en-US" | |
if [ ! "$1" ]; then | |
# default if no argument is set: | |
version="95.0" # chose from http://download.cdn.mozilla.net/pub/mozilla.org/firefox/releases/ | |
application="firefox" # "thunderbird" or "firefox" but file extension, archive extraction, and binary | |
fi |
from sklearn.model_selection import train_test_split | |
from sklearn.linear_model import LogisticRegression | |
from conformal.conformal_predictor import InductiveConformalPredictor | |
data = load_digits() | |
X, y = data.data, data.target | |
alpha = 0.05 | |
seed = 41 | |
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, |
def get_jacobian(net, x, noutputs): | |
x = x.squeeze() | |
n = x.size()[0] | |
x = x.repeat(noutputs, 1) | |
x.requires_grad_(True) | |
y = net(x) | |
y.backward(torch.eye(noutputs)) | |
return x.grad.data |
To remove a submodule you need to: | |
Delete the relevant line from the .gitmodules file. | |
Delete the relevant section from .git/config. | |
Run git rm --cached path_to_submodule (no trailing slash). | |
Commit and delete the now untracked submodule files. |
import torch | |
import numpy as np | |
from matplotlib import pyplot as plt | |
def make_model_diagrams(outputs, labels, n_bins=10): | |
""" | |
outputs - a torch tensor (size n x num_classes) with the outputs from the final linear layer | |
- NOT the softmaxes | |
labels - a torch tensor (size n) with the labels | |
""" |
def color(text, **user_styles): | |
styles = { | |
# styles | |
'reset': '\033[0m', | |
'bold': '\033[01m', | |
'disabled': '\033[02m', | |
'underline': '\033[04m', | |
'reverse': '\033[07m', |
The following two functions will stream just about any audio or video file to any browsers supporting mp3 and/or webm. Due to the unknown number of bytes, a custom html5 audio/video player will have to be written (my next step) to allow seeking.
For w/e reason node.js didn't want to spawn a child process with a unix pipe in it. This could be so that they can keep support for windows computers. As such I've created the following bash script:
#!/bin/bash
START_TIME=${2:-0}
VARIABLE_BIT_RATE=${3:-4}
ABSOLUTE_PATH=$1
#!/usr/bin/env python | |
""" | |
Requires pychromecast. | |
Install with `pip install pychromecast` | |
usage: cast.py [-h] -d DEVICE -v VIDEO | |
Cast YouTube videos headlessly. |