Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Update a simple plot as rapidly as possible to measure speed.
"""
## Add path to library (just for examples; you do not need this)
from pyqtgraph.Qt import QtGui, QtCore
import numpy as np
import pyqtgraph as pg
@nyanpasu64
nyanpasu64 / gui600.py
Created November 22, 2018 07:08
pyqtgraph plot 600 times... qimage is much slower
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Update a simple plot as rapidly as possible to measure speed.
"""
## Add path to library (just for examples; you do not need this)
from pyqtgraph.Qt import QtGui, QtCore
import numpy as np
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Update a simple plot as rapidly as possible to measure speed.
"""
## Add path to library (just for examples; you do not need this)
from pyqtgraph.Qt import QtGui, QtCore
import numpy as np
@nyanpasu64
nyanpasu64 / file.md
Last active August 23, 2018 01:54
FM synthesis

The human ear hears sine waves.

If you hear a complex waveform (like a square wave), the ear decomposes it into sine wave "harmonics", which are all multiples of a "fundamental" frequency.

The human ear identifies pitch as the "fundamental" frequency, AKA the GCD(sine harmonics), AKA period of a waveform.

VRC7 plays a carrier sine at f, and applies FM at g to create a series of sine "harmonics" at f ± y*g for integer y. Loudness decreases as abs(y) increases. If f is 8 and g is 1, the waveform will sound bright, piercing, and bassless (since it only has high frequencies around 8).

The resulting waveform has a period of gcd(f, g), and all "harmonics" are multiples of gcd(f, g), so the ear hears a tone at gcd(f, g).

import re
import sys
def exitPrompt(string="Press enter to exit. . ."):
input(string)
exit()
def error(string, quit=True):
if (quit): exitPrompt("Error: %s" % string)
else: print(string)
ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAj3T0LkSVqfEZIpugjwqH1RjSyUDaWjCy8EhpyxYWL0hlNibwSAgqm33UU28Rx7r+i66KN+CSR5dJP3ONj5X2e7A0vlSuhobI71eEvyF1eTMw7cXLOSWca/YvVx8RNYv7dmflXyg+dLBM0xDHNUz0BFNtbkBDq8wad7WT5CxmAASJLRXvI9TFcIaNbV3P6mP0/GCsv+/CCdp/kW5/lC2a9fBUKaR2YNMq8xC/4a3zXZjNz6d9Qqy6LJHCywVfLOeI2c9r2OhL4dXIgKDH6vIfdn+71Pf7mkbGolI7eGR76d0qsL3+93ADOq2PVohbAI5N1Ib/sSykjsc6g3YA4rHoyQ== flip-20160816
javascript:(function()%7Balert(document.cookie)%7D)()
@nyanpasu64
nyanpasu64 / droid-sans.css
Created January 9, 2018 04:08
Open Sans -> Droid Sans
@font-face {
font-style: normal;
font-weight: 400;
font-family: "Open Sans";
src: local("Droid Sans")
}
@font-face {
font-style: normal;
font-weight: 700;
font-family: "Open Sans";
@nyanpasu64
nyanpasu64 / mml.py
Last active December 19, 2017 08:48
0CC-Famitracker MML Python
HEX = ['0x', '$']
LOOP = '|'
RELEASE = '/'
class MML:
def __init__(self, string):
self.arr = []
self.loop = None
self.release = None
a = string.split()
3 5 7 8 9 10 10 11 11 11 12 12 12 12 13 13 13 13 13 14 14 14 14 14 14 15 15 15 15 15 15 15 15 15 15 15 15 15 14 14 14 14 14 14 14 14 14 14 14 14 13 13 13 13 13 13 13 13 13 13 13 13 12 12 12 12 12 12 12 12 12 12 12 12 12 11 11 11 11 11 11 11 11 11 11 11 11 11 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0