Skip to content

Instantly share code, notes, and snippets.

View playgrdstar's full-sized avatar

Ming | Gary Ang playgrdstar

View GitHub Profile
@ovrnt
ovrnt / install_gpu_ubuntu_2204.sh
Created January 29, 2024 05:00
Yam Peleg's Ubuntu 22.04 “CUDA + GPU Drivers + CuDNN and everything else” installer (https://twitter.com/Yampeleg/status/1751823896800583924)
#!/bin/bash
# Verify if GPU is CUDA-enabled
lspci | grep -i nvidia
# Remove previous NVIDIA driver installation
sudo apt-get purge nvidia* -y
sudo apt remove nvidia-* -y
sudo rm /etc/apt/sources.list.d/cuda* -y
sudo apt-get autoremove && sudo apt-get autoclean -y
@rasbt
rasbt / video-subtitles-via-whisper.py
Last active September 19, 2023 21:14
Script that creates subtitles (closed captions) for all MP4 video files in your current directory
# Sebastian Raschka 09/24/2022
# Create a new conda environment and packages
# conda create -n whisper python=3.9
# conda activate whisper
# conda install mlxtend -c conda-forge
# Install ffmpeg
# macOS & homebrew
# brew install ffmpeg
# Ubuntu
@paddymccrudden
paddymccrudden / Fleishman.py
Last active February 3, 2022 17:45 — forked from zeimusu/Fleishman.py
Generate data with given mean, standard deviation, skew, and kurtosis. Intended for monte carlo simulations with non normal distributions
import numpy as np
from numpy.linalg import solve
import logging
logging.basicConfig(level = logging.DEBUG)
from scipy.stats import moment,norm
def fleishman(b, c, d):
"""calculate the variance, skew and kurtois of a Fleishman distribution
F = -c + bZ + cZ^2 + dZ^3, where Z ~ N(0,1)
"""
@logancyang
logancyang / space-colonization.js
Created July 28, 2020 22:07
A 2D version of space colonization algorithm in JavaScript
class Leaf {
constructor() {
this.pos = createVector(random(width), random(height));
this.reached = false;
}
show() {
fill(255, 255, 0);
noStroke();
ellipse(this.pos.x, this.pos.y, 8, 8);
@AFAgarap
AFAgarap / autoencoder-pytorch.ipynb
Last active April 28, 2024 12:30
PyTorch implementation of an autoencoder.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@GerardBCN
GerardBCN / monte_carlo.ipynb
Last active July 31, 2020 01:58
State-value function approximation for the gridworld task using Monte Carlo simulations
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@GerardBCN
GerardBCN / policy_iterator_RL_gridworld.ipynb
Created December 20, 2018 13:59
Policy iterator for RL applied to gridworld
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yang-zhang
yang-zhang / pytorch-losses-in-plain-python.ipynb
Last active December 21, 2022 07:14
git/yang-zhang.github.io/ds_code/pytorch-losses-in-plain-python.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@HarshTrivedi
HarshTrivedi / pad_packed_demo.py
Last active March 2, 2024 16:49 — forked from Tushar-N/pad_packed_demo.py
Minimal tutorial on packing (pack_padded_sequence) and unpacking (pad_packed_sequence) sequences in pytorch.
import torch
from torch import LongTensor
from torch.nn import Embedding, LSTM
from torch.autograd import Variable
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
## We want to run LSTM on a batch of 3 character sequences ['long_str', 'tiny', 'medium']
#
# Step 1: Construct Vocabulary
# Step 2: Load indexed data (list of instances, where each instance is list of character indices)
@bshishov
bshishov / forecasting_metrics.py
Last active April 20, 2024 04:29
Python Numpy functions for most common forecasting metrics
import numpy as np
EPSILON = 1e-10
def _error(actual: np.ndarray, predicted: np.ndarray):
""" Simple error """
return actual - predicted