Skip to content

Instantly share code, notes, and snippets.

View yoyolicoris's full-sized avatar
😴
Back at home

Scusk Rimsi yoyolicoris

😴
Back at home
View GitHub Profile
@r9y9
r9y9 / mlsa_filter.h
Last active February 15, 2023 11:07
MLSA digital filter for speech synthesis in C++
#pragma once
#include <cmath>
#include <memory>
#include <vector>
#include <cassert>
namespace sp {
/**
@bastibe
bastibe / limiter_python.py
Created October 11, 2015 10:58
A simple limiter in Python
# A simple limiter
from sounddevice import Stream, CallbackStop
from time import sleep
from numpy import array, random, zeros
import matplotlib.pyplot as plt
################################### Constants ##################################
fs = 44100 # Hz
@billju
billju / Drumpad.cpp
Last active October 21, 2021 01:58
/*
Super Easy Diy Drumpad Example
GIT: https://gist.github.com/billju/ce1337ea3c1dbb4341ce22dca1b55442
2017 by Billju
Inspired by Evan Kale
*/
#include <Keyboard.h>
#include "MIDIUSB.h"
@DanielArnett
DanielArnett / vive-tracker-ubuntu-instructions.md
Last active July 18, 2024 03:38
How to use the HTC Vive Trackers in Ubuntu using Python 3.6.

This tutorial will guide you through the setup of the HTC Vive Tracker in Python 3.6 on Ubuntu 14.04.

Prerequesites

Up to date graphics drivers

x86 architecture

SteamVR requires >4GB disk space

@f0k
f0k / nvidia_boost.sh
Created December 6, 2017 17:45
Set Nvidia GPU application clocks and power limits to maximum supported values
#!/bin/bash
# Sets each CUDA device to persistence mode and sets the application clock
# and power limit to the device's maximum supported values.
# When run with "--dry-run" as first command line argument or not as superuser,
# will display the commands, otherwise it will execute them.
#
# Hint: To run this at boot time, place this script in /root and create a file
# /etc/cron.d/nvidia_boost with the following single line:
# @reboot root /root/nvidia_boost.sh >/dev/null
#
@jojonki
jojonki / ema.py
Last active March 13, 2020 05:18
Apply exponential moving average decay for variables in PyTorch
# How to apply exponential moving average decay for variables?
# https://discuss.pytorch.org/t/how-to-apply-exponential-moving-average-decay-for-variables/10856/2
class EMA(nn.Module):
def __init__(self, mu):
super(EMA, self).__init__()
self.mu = mu
def forward(self,x, last_average):
new_average = self.mu*x + (1-self.mu)*last_average
return new_average
@carlthome
carlthome / Signal reconstruction from spectrograms.ipynb
Created May 31, 2018 13:53
Try to recover audio from filtered magnitudes when phase information has been lost.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dojoteef
dojoteef / profile.py
Last active June 5, 2023 11:44
A CUDA memory profiler for pytorch
'''
Memory profiling utilities
'''
import gc
import inspect
import linecache
import os.path
import sys
import time
import threading
@mikehamer
mikehamer / pytorch_custom_backward.cpp
Created April 9, 2019 13:28
An example of using the PyTorch C++ API to implement a custom forward and backward function
// An example of using the PyTorch C++ API to implement a custom forward and backward function
#include <iostream>
#include <vector>
#include <torch/torch.h>
#include <torch/csrc/autograd/variable.h>
#include <torch/csrc/autograd/function.h>
#include <torch/csrc/autograd/VariableTypeUtils.h>
#include <torch/csrc/autograd/functions/utils.h>
@unixpickle
unixpickle / maml.py
Created October 12, 2019 19:08
MAML in PyTorch
import torch
import torch.nn.functional as F
def maml_grad(model, inputs, outputs, lr, batch=1):
"""
Update a model's gradient using MAML.
The gradient will point in the direction that
improves the total loss across all inner-loop