Skip to content

Instantly share code, notes, and snippets.

const canvasSketch = require("canvas-sketch");
const Tweakpane = require("tweakpane");
const settings = {
dimensions: [2048, 2048],
animate: true,
};
const params = {
rows: 10,
@kasthor
kasthor / AzureAuthContext.js
Created April 20, 2021 01:34
Authenticate to Azure with Hooks
import { PublicClientApplication } from "@azure/msal-browser";
import { Client } from "@microsoft/microsoft-graph-client";
import React, { useState, createContext, useEffect } from "react";
export const AzureAuthContext = createContext({});
export const AzureAuthProvider = ({ children }) => {
const [isAuthenticated, setIsAuthenticated] = useState(false);
const [userProfile, setUserProfile] = useState({});
const ACTIVE_DIRECTORY_SCOPES = ['user.read'];
@kasthor
kasthor / mouse-level.p5.js
Created March 27, 2021 01:39
Paint with Music
let mic, timeline, minLevel, maxLevel;
function setupAudio(){
userStartAudio();
mic = new p5.AudioIn();
mic.start();
}
function setup() {
@kasthor
kasthor / Main.gd
Last active January 3, 2024 18:23
Minimum code to draw an image to screen in Godot
extends Node2D
var image
var should_update_canvas = false
var drawing = false
# Called when the node enters the scene tree for the first time.
func _ready():
create_image()
update_texture()
let fft, mic, waveform, spectrum;
function setupAudio(){
userStartAudio();
mic = new p5.AudioIn();
mic.start();
fft = new p5.FFT(0, 2048);
fft.setInput(mic);
}
let mic, timeline;
function setupAudio(){
userStartAudio();
mic = new p5.AudioIn();
mic.start();
}
function setup() {
@kasthor
kasthor / fft.p5.js
Last active March 20, 2021 02:28
p5 Audio analysis with FFT
let fft, mic, waveform, spectrum;
function setupAudio(){
userStartAudio();
mic = new p5.AudioIn();
mic.start();
fft = new p5.FFT(0.9, 1024);
fft.setInput(mic);
}
@kasthor
kasthor / install.sh
Created June 13, 2017 20:04 — forked from domderen/install.sh
Installation of apache spark on ubuntu machine.
#!/bin/sh
# installation of Oracle Java JDK.
sudo apt-get -y update
sudo apt-get -y install python-software-properties
sudo add-apt-repository -y ppa:webupd8team/java
sudo apt-get -y update
sudo apt-get -y install oracle-java7-installer
# Installation of commonly used python scipy tools
<html>
<head>
<title>Opentok Experiment</title>
<script src='https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.2/underscore-min.js'></script>
<script src='http://static.opentok.com/webrtc/v2.2/js/opentok.min.js'></script>
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
<script type="text/javascript">
// Initialize API key, session, and token...
// Think of a session as a room, and a token as the key to get in to the room
// Sessions and tokens are generated on your server and passed down to the client