Instantly share code, notes, and snippets.
Discover gists
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
importnumpyasnp | |
fromPILimportImage | |
IMG_PATH="./assets/water.jpeg" | |
defquantise(pixelList,width,height): | |
pixels=np.array([(q(r),q(g),q(b))forr,g,binpixelList],dtype=np.uint8) | |
returnpixels.reshape([height,width,3]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
{ | |
"uuid":"e24b4542-ce5d-4625-b2cb-e40429945328", | |
"json": [ | |
{ | |
"type":1, | |
"name":"if101[屏蔽国内ip]", | |
"api":"http://api.if101.tv/v1/vod" | |
}, | |
{ | |
"type":0, |
Adaptation ofSethares' dissonance measurement function to Python
Example is meant to match the curve inFigure 3:
Original model used products of the two amplitudesa1⋅a2, but this was changed to minimum of the two amplitudesmin(a1, a2), as explained inG: Analysis of the Time Domain Model appendix ofTuning, Timbre, Spectrum, Scale.
This weighting is incorporated into the dissonance model (E.2) by assuming that the roughness is proportional to the loudness of the beating. ... Thus, the amplitude of the beating is given by the minimum of the two amplitudes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
using UnityEngine; | |
/// <summary> | |
/// DC Button Script by Zay/Lucid | |
/// Touch this button in VR to open a Discord link. | |
/// Attach this to a 3D button object with a collider. Ensure player hands have tag "Hand" or include "hand" in their name. | |
/// </summary> | |
public class DCButtonScriptByZayLucid : MonoBehaviour | |
{ | |
[Tooltip("Discord invite URL")] |
marcogandra /waitress_server.py
CreatedApril 28, 2022 11:20 — forked fromddelpero/waitress_server.py
Python waitress windows service This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
# Example class to start a Waitress server as a windows service | |
# the specific use case is running Waitress as a windows server using pywin32 | |
# The Waitress docs only show how to use waitress-serve, but since waitress-serve is blocking | |
# you don't get a return value, which makes it impossible to gracefully stop the Waitress server | |
# from a windows service | |
# However, looking at the waitress-serve code, it's easy to write a custom class | |
# example pywin32 windows service: https://gist.github.com/drmalex07/10554232 | |
fromwaitress.serverimportcreate_server |
NewerOlder