Skip to content

Instantly share code, notes, and snippets.

@kistaaa
kistaaa / goldenangle.au3
Created April 12, 2018 04:06
AutoIT Scripts for SFD
#include <AutoItConstants.au3>
$size = 0
; center horizontal of your screen
$centerX = @DesktopWidth / 2
; center vertical of your screen
$centerY = @DesktopHeight / 2
@kistaaa
kistaaa / tree.au3
Created April 17, 2018 13:35
Fractal Tree AutoIT
#include <AutoItConstants.au3>
; THESE 3 VARS ARE ALL YOU NEED LOL
; starting branch length
$startLength = 350
; angle to twist the tree
$startAngle = 45
@kistaaa
kistaaa / midi_python_blender.py
Last active November 12, 2022 17:56
Convert midi events to a list for importing in Blender
from mido import MidiFile
tempo=0
noteons = []
notas = []
mid = MidiFile('C:/scripts-python/meow.mid')
for evt in mid:
if not evt.is_meta:
tempo += evt.time
if evt.type == 'note_on':
@kistaaa
kistaaa / exponentialRampToValueAtTime.js
Last active November 12, 2022 17:59
Fix Web Audio "click" sound
var context = new AudioContext();
var oscillator = context.createOscillator();
var gainNode = context.createGain();
oscillator.connect(gainNode);
gainNode.connect(context.destination)
oscillator.start();
stopButton.addEventListener('click', function() {
@kistaaa
kistaaa / apply_central_impulse_2d.gd
Last active November 12, 2022 17:58
Godot Impulse 2D of "f" amount in a random direction
extends RigidBody2D
var f = 500
func _ready():
apply_central_impulse(Vector2(rand_range(-f, f),rand_range(-f,f)))
@kistaaa
kistaaa / hexnum.js
Last active April 29, 2023 22:07
JS numbers to HEX and reverse
const hex = (num) => num.toString(16).padStart(2, '0')
const num = (hex) => parseInt(hex, 16)
@kistaaa
kistaaa / randomcolor.svelte
Created February 27, 2023 20:20
Svelte Random Color Generator
<script>
const hex = (d) => Number(d).toString(16).padStart(2, '0')
const rnd = () => Math.floor(Math.random() * 256)
let color = hex(rnd()) + hex(rnd()) + hex(rnd())
const gen = () => color = hex(rnd()) + hex(rnd()) + hex(rnd())
</script>
<style>
.color{display:inline-block; padding:24px; border-radius:50px; vertical-align: middle;}
.text{display:inline-block; font-size:24px; vertical-align: middle;}
{
"keys": {
"0": "C-1",
"1": "C#-1",
"2": "D-1",
"3": "D#-1",
"4": "E-1",
"5": "F-1",
"6": "F#-1",
"7": "G-1",
// Is x really array?
Array.isArray(x)
// Add array y to the end of x
x.concat(y)
// Is y in x?
x.includes(y)
// Which index is y?
@kistaaa
kistaaa / obj-to-css-and-back.js
Last active April 29, 2023 22:20
Object and CSS conversion, for using on "style=" in html elements
// object to css
Object.prototype.css = function() {return Object.entries(this).map(([k, v]) => `${k}:${v}`).join(';')}
// css to object
String.prototype.obj = function() {
let obj = {}
let parts = this.split(";")
for(let part of parts){
let prop = part.split(':')
obj[prop[0]] = prop[1]