Skip to content

Instantly share code, notes, and snippets.

View moskomule's full-sized avatar
🎯
Focusing

Ryuichiro Hataya moskomule

🎯
Focusing
View GitHub Profile
@ryin
ryin / tmux_local_install.sh
Last active April 23, 2024 01:06
bash script for installing tmux without root access
#!/bin/bash
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
TMUX_VERSION=1.8
@sevko
sevko / README.md
Created September 3, 2015 16:47
simple Python raytracer

raytracer

A simple Python raytracer that supports spheres with configurable "material" properties (base color and a bunch of light coefficients). To generate a raytraced image of the pre-defined scene, run: python raytracer.py and open image.ppm with a PPM-compatible viewer (eog works fine on Linux):

raytraced spheres

acknowledgements

I found the following resources extremely helpful:

@yrevar
yrevar / imagenet1000_clsidx_to_labels.txt
Last active July 3, 2024 18:29
text: imagenet 1000 class idx to human readable labels (Fox, E., & Guestrin, C. (n.d.). Coursera Machine Learning Specialization.)
{0: 'tench, Tinca tinca',
1: 'goldfish, Carassius auratus',
2: 'great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias',
3: 'tiger shark, Galeocerdo cuvieri',
4: 'hammerhead, hammerhead shark',
5: 'electric ray, crampfish, numbfish, torpedo',
6: 'stingray',
7: 'cock',
8: 'hen',
9: 'ostrich, Struthio camelus',
@aaronpolhamus
aaronpolhamus / map_clsloc.txt
Created May 12, 2016 01:21
Image net classes + labels
n02119789 1 kit_fox
n02100735 2 English_setter
n02110185 3 Siberian_husky
n02096294 4 Australian_terrier
n02102040 5 English_springer
n02066245 6 grey_whale
n02509815 7 lesser_panda
n02124075 8 Egyptian_cat
n02417914 9 ibex
n02123394 10 Persian_cat
import weakref
import matplotlib.pyplot as plt
import numpy
from sklearn.datasets import fetch_mldata
class Variable(object):
def __init__(self, data):
self.data = data
@apaszke
apaszke / Rop.py
Last active January 16, 2023 07:20
def Rop(y, x, v):
"""Computes an Rop.
Arguments:
y (Variable): output of differentiated function
x (Variable): differentiated input
v (Variable): vector to be multiplied with Jacobian from the right
"""
w = torch.ones_like(y, requires_grad=True)
return torch.autograd.grad(torch.autograd.grad(y, x, w), w, v)
@a-maumau
a-maumau / nvme_mount.md
Last active May 29, 2024 01:40
how to mount m.2 ssd/hdd
@soumith
soumith / gist:01da3874bf014d8a8c53406c2b95d56b
Last active March 28, 2022 16:53
Install PillowSIMD+libjpeg-turbo on Conda
conda uninstall --force pillow -y
# install libjpeg-turbo to $HOME/turbojpeg
git clone https://github.com/libjpeg-turbo/libjpeg-turbo
pushd libjpeg-turbo
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX:PATH=$HOME/turbojpeg
make
make install
@rxwei
rxwei / ad-manifesto.md
Last active November 9, 2023 09:58
First-Class Automatic Differentiation in Swift: A Manifesto
@rwightman
rwightman / image_folder_tar.py
Created July 24, 2019 05:01
PyTorch ImageFolder style dataset for reading directly from tarfile
import torch.utils.data as data
import os
import re
import torch
import tarfile
from PIL import Image
IMG_EXTENSIONS = ['.png', '.jpg', '.jpeg']