Skip to content

Instantly share code, notes, and snippets.

View jakelevi1996's full-sized avatar

jakelevi1996

View GitHub Profile
@jakelevi1996
jakelevi1996 / Notes on bash.md
Last active February 20, 2023 14:18
Notes on bash
@botforge
botforge / gym_to_gif.py
Last active April 29, 2024 10:27
Save OpenAI Gym renders as GIFS
from matplotlib import animation
import matplotlib.pyplot as plt
import gym
"""
Ensure you have imagemagick installed with
sudo apt-get install imagemagick
Open file in CLI with:
xgd-open <filelname>
@jakelevi1996
jakelevi1996 / Speed tests.md
Last active December 31, 2019 01:02
Speed tests

Speed tests

Shown below is some code to perform generic speed tests and save a log-log graph of the results (in this example, eigenvalue decomposition for SPD matrices is being tested). The resulting graph is shown below the code:

import numpy as np
import matplotlib.pyplot as plt
import scipy as sp
from time import perf_counter
@jakelevi1996
jakelevi1996 / Gist "To do" list.md
Last active February 17, 2020 17:05
Gist "To do" list

Gist "To do" list

Here is my to-do list for Gists/things I intend to write Gists about:

  • Generic Bayesian linear regression: as basis functions, define some classes with __call__ methods (EG Gaussian, polynomials) which take appropriate parameters to their __init__ method (EG location, scale, polynomial order); a given Bayesian linear regression solution should accept a list of basis functions, whose outputs for each data point can be calculated with the built-in map function, or numpy.vectorise, and compare the output with the MAP and ML solutions, EG:
import numpy as np

class Sigmoid:
    def __init__(self, loc): self.loc = loc
 def __call__(self, x): return 1.0 / (1.0 + np.exp(self.loc - x))
@nadavrot
nadavrot / Matrix.md
Last active June 23, 2024 10:25
Efficient matrix multiplication

High-Performance Matrix Multiplication

This is a short post that explains how to write a high-performance matrix multiplication program on modern processors. In this tutorial I will use a single core of the Skylake-client CPU with AVX2, but the principles in this post also apply to other processors with different instruction sets (such as AVX512).

Intro

Matrix multiplication is a mathematical operation that defines the product of

@evertrol
evertrol / Makefiles.md
Last active April 1, 2024 19:11
Makefile cheat sheet

Makefile cheat sheet

Mostly geared towards GNU make

I've used ->| to indicate a tab character, as it's clearer to read than

  • Set a target, its dependencies and the commands to execute in order
target: [dependencies]
-&gt;| 
@justincbagley
justincbagley / How_to_Convert_Markdown_to_PDF.md
Last active June 14, 2024 22:42
How To Convert Markdown to PDF

How to convert markdown to PDF:

This post reviews several methods for converting a Markdown (.md) formatted file to PDF, from UNIX or Linux machines.

Using Pandoc:

$ pandoc How_I_got_svg-resizer_working_on_Mac_OSX.md -s -o test1.pdf
@jovianlin
jovianlin / get_available_gpus.py
Created October 3, 2016 09:58
Get List of Devices in TensorFlow
from tensorflow.python.client import device_lib
def get_available_gpus():
local_device_protos = device_lib.list_local_devices()
return [x.name for x in local_device_protos if x.device_type == 'GPU']
get_available_gpus()
@karpathy
karpathy / min-char-rnn.py
Last active June 28, 2024 06:13
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)