Skip to content

Instantly share code, notes, and snippets.

View drjasonharrison's full-sized avatar

Jason Harrison drjasonharrison

View GitHub Profile
@shadiabuhilal
shadiabuhilal / dot-env.sh
Last active March 18, 2024 10:30
Load environment variables from dotenv / .env file in Bash script
#!/bin/bash
# Specify the path to your .env file
ENV_FILE=".env"
# Function to success color text with green
successText() {
tput setaf 2
echo "$@"
tput sgr0
@piyueh
piyueh / list_files_in_docker_layers.py
Created May 31, 2022 20:34
List files in each layer of an image tarball created through `docker save`.
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2022 Pi-Yueh Chuang <pychuang@pm.me>
#
# Distributed under terms of the BSD 3-Clause license.
"""List files in each layer of an image tarball created through `docker save`.
"""
@earthbound19
earthbound19 / OklabExperiments.js
Last active April 6, 2024 11:10
rgb <-> oklab to/from convert, color blend through oklab space
// This gist contains JavaScript functions and tests for:
// - conversion from gamma-corrected (or gamma-compressed) sRGB to linear RGB, to Oklab
// - interpolation through Oklab
// - conversion back to linear RGB, then sRGB
// To use these tests, install nodejs, save this file locally, and run with:
// node OklabExperiments.js
// No other dependencies are required to use this.
// Thanks to some helpful folks in the generative art community for helping me better understand what's happening with this.
// My toddler smacked the keyboard with a piece of cardboard and made me accidentally type:
@mattbryson
mattbryson / recover_ready_nas.sh
Last active December 24, 2023 23:34
Recover Data from ReadyNas Duo hard drives
# Recover Data from ReadyNas Duo RAID 1 drives
#
# DISCLAIMER : This could corrupt all your data - if you are at all worried get a professional to recover the data for you
#
# The tools mentioned below have the ability to corrupt and wipe all your data
#
# #### USE AT YOUR OWN RISK ####
#
# With that out the way....
#
<?
//
// AUTO KEYWORD-BASED FOLLOWER CURATION BOT (by @levelsio)
//
// File: twitterFollowerCuratorBot.php
//
// Created: May 2021
// License: MIT
//
@nileshtrivedi
nileshtrivedi / home-server.md
Last active January 10, 2024 06:30
Home Server setup: Raspberry PI on Internet via reverse SSH tunnel

Raspberry Pi on Internet via reverse SSH tunnel

HackerNews discussed this with many alternative solutions: https://news.ycombinator.com/item?id=24893615

I already have my own domain name: mydomain.com. I wanted to be able to run some webapps on my Raspberry Pi 4B running perpetually at home in headless mode (just needs 5W power and wireless internet). I wanted to be able to access these apps from public Internet. Dynamic DNS wasn't an option because my ISP blocks all incoming traffic. ngrok would work but the free plan is too restrictive.

I bought a cheap 2GB RAM, 20GB disk VM + a 25GB volume on Hetzner for about 4 EUR/month. Hetzner gave me a static IP for it. I haven't purchased a floating IP yet.

@premek
premek / mv.sh
Last active March 5, 2024 17:43
Rename files in linux / bash using mv command without typing the full name two times
# Put this function to your .bashrc file.
# Usage: mv oldfilename
# If you call mv without the second parameter it will prompt you to edit the filename on command line.
# Original mv is called when it's called with more than one argument.
# It's useful when you want to change just a few letters in a long name.
#
# Also see:
# - imv from renameutils
# - Ctrl-W Ctrl-Y Ctrl-Y (cut last word, paste, paste)
@Guitaricet
Guitaricet / reproducibility.md
Last active March 24, 2024 11:11
Notes on reproducibility in PyTorch

Reproducibility

ML experiments may be very hard to reproduce. You have a lot of hyperparameters, different dataset splits, different ways to preprocess your data, bugs, etc. Ideally, you should log data split (already preprocessed), all hyperparameters (including learning rate scheduling), the initial state of your model and optimizer, random seeds used for initialization, dataset shuffling and all of your code. Your GPU is also should be in deterministic mode (which is not the default mode). For every single model run. This is a very hard task. Different random seed can significantly change your metrics and even GPU-induced randomness can be important. We're not solving all of these problems, but we need to address at least what we can handle.

For every result you report in the paper you need (at least) to:

  1. Track your model and optimizer hyperparameters (including learning rate schedule)
  2. Save final model parameters
  3. Report all of the parameters in the pap
@lisawolderiksen
lisawolderiksen / git-commit-template.md
Last active April 22, 2024 13:01
Use a Git commit message template to write better commit messages

Using Git Commit Message Templates to Write Better Commit Messages

The always enthusiastic and knowledgeable mr. @jasaltvik shared with our team an article on writing (good) Git commit messages: How to Write a Git Commit Message. This excellent article explains why good Git commit messages are important, and explains what constitutes a good commit message. I wholeheartedly agree with what @cbeams writes in his article. (Have you read it yet? If not, go read it now. I'll wait.) It's sensible stuff. So I decided to start following the

@kobybum
kobybum / unused_modules.sh
Last active April 5, 2024 00:44
Finding Unused Python Files
#!/bin/bash
# This is part of a Medium article about finding unused files:
# https://medium.com/@kobybum/finding-dead-python-files-with-snakefood-6c75a3e82294
# Generate a list of included dependencies
sfood -i example-project > /tmp/out.deps
# Get dependant filepath from each dependency, sort and get unique
cat /tmp/out.deps | \
grep -v test | \