Skip to content

Instantly share code, notes, and snippets.

View Sangarshanan's full-sized avatar
🎮
We live in a society

sangarshanan Sangarshanan

🎮
We live in a society
View GitHub Profile
@Sangarshanan
Sangarshanan / hydra-audio-reactive.js
Created November 7, 2024 15:21
Audio Reactive Visuals with Hydra.xyz
noise()
.color(() => a.fft[2]*2,0,.6)
.modulate(noise(() => a.fft[0]*10))
.scale(()=> a.fft[2]*5)
.layer(
src(o0)
.mask(osc(10).modulateRotate(osc(),90,0))
.scale(() => a.fft[0]*2)
.luma(0.2,0.3)
)
@Sangarshanan
Sangarshanan / strudel_1.mjs
Created November 6, 2024 09:30
Strudel stuff
// First upload (misc exp)
stack(
n("<0*2 1 [4 2] 3*2>*4").sound("wind"),
note("[C G], <D Fb B C A>*[0.5,2]")
.sound("space").gain(3)
.lpf("<100 200 300 400 500 600 700 800 900 1000 1100 1000 900 800 700 600 500 400 300 200>/4")
.room(1)
.pan("<0 1>/2")
.delay(1)
@Sangarshanan
Sangarshanan / misc
Last active August 17, 2024 11:33
Punctual gist
-- fit 3 $ circle [sin cps, osc 0] [osc 0.5, 0.5] * (osc ft) * 0.2 >> video;
-- fit 3 $ circle [0, sin cps] [osc 0.5, 0.5] * 0.2 >> video;
circle [0.0, 0.0] (osc ft) * 0.3 >> red;
fit 1 $ circle [osc 0.1, 0.0] (osc ft) * 0.3 >> blue;
fit 1 $ circle [0.1, osc 0.1] (osc ft) * 0.3 >> green;
-- mesh [0,0.1] [0.5,0.5] * (osc ft) * 0.2 >> blue;
-- mesh [0,-0.1] [0.5,0.5] * (osc ft) * 0.2 >> video;
@Sangarshanan
Sangarshanan / AbstractSummariser.ipynb
Last active April 22, 2024 14:04
Summarise Abstracts from Proposals
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
// A Lonely Spaceship Travelling the Expanse of the Universe
function setup() {
// A Nice Canvas to Draw
createCanvas(350, 600);
}
function SpaceBackground() {
// Space is Dark
background(0, 0, 0);
"""
Folium choloropeth with suport for Branca colormaps and custom feature functions
"""
import folium
import warnings
import numpy as np
from folium.map import FeatureGroup
from branca.utilities import color_brewer
from branca.colormap import ColorMap, StepColormap, LinearColormap
"""Count Min Hash."""
from hashlib import md5, sha1, blake2b, sha3_512
def get_row_column(value, hash_fns, m):
"""Fetch Row and Column."""
for row, _hash_fn in enumerate(hash_fns):
column = (
int(
"""Hyper Log Log."""
import math
from hashlib import sha1
class HyperLogLog(object):
"""HyperLogLog."""
def __init__(self, k):
"""Initialize Bucket Size."""
self.k = k
"""Basic Proxies in Python."""
"""Twisted."""
from twisted.internet import reactor
from twisted.web import proxy, server
site = server.Site(proxy.ReverseProxyResource("example.com", 80, b""))
reactor.listenTCP(8080, site)
reactor.run()
"""Huffman Puffman.
Visualize the Tree on https://github.com/Sangarshanan/huffman-coding
"""
import heapq
from collections import Counter
def encode_message(message):
"""
Convert the String to a Fixed 8 bit binary
ord(character) -> Unicode -> 08b binary