Skip to content

Instantly share code, notes, and snippets.

View mogwai's full-sized avatar

Harry Coultas Blum mogwai

View GitHub Profile
@mogwai
mogwai / hash.py
Created March 10, 2024 10:26
Hashing torch
import torch
import io
import numpy as np
import hashlib
x = torch.randn(1, 20)
buff = io.BytesIO()
torch.save(x, buff)
buff.seek(0)
@mogwai
mogwai / cache.py
Last active January 19, 2024 13:17
A simple method to cache functions to some folder basesd on the arguments
import hashlib
import numpy as np
from torch import Tensor
from typing import Union
import os
import pickle
from functools import wraps
def sha256(b: Union[float, list, Tensor, str, bytes, np.ndarray]):
if isinstance(b, (int, list, float)):
@mogwai
mogwai / resample_benchmark.ipynb
Last active January 11, 2023 03:42
Resampling Benchmarks
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mogwai
mogwai / nbrecord.ipynb
Created July 15, 2020 18:16
Notebook Audio Recorder
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
curl -L https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh | sh -
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
source ~/.bashrc
nvm install stable
nvm use stable
npm i -g speed-test
# Install Docker
sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt-get update
curl -L https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh | sh -
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
source ~/.bashrc
nvm install stable
nvm use stable
npm i -g speed-test
# Install Docker
sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt-get update
@mogwai
mogwai / setupk3svms.sh
Last active April 4, 2020 11:31
Setup k3s VMs
# Install multipass
sudo snap install multipass --classic
# Launch nodes
multipass launch -n master & multipass launch -n node1 & multipass launch -n node2
# Download, transfer and run master install script
curl -sfL https://get.k3s.io > k3s.sh
multipass transfer k3s.sh master:
multipass exec master bash k3s.sh
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Layout info:
{
"id": "com.apple.keylayout.British-PC",
"lang": "en"
}
isUSStandard: false
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| HW Code combination | Key | KeyCode combination | Pri | UI label | User settings | Electron accelerator | Dispatching string | WYSIWYG |
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| KeyA | a | A | | A | a | A | [KeyA] | |