Skip to content

Instantly share code, notes, and snippets.

@Sciss
Sciss / library,js
Created December 27, 2020 19:28 — forked from aknuds1/library,js
Emscripten - how to pass an array of floating point numbers from JavaScript to a C callback, to let the latter fill it with data.
// "use strict";
var LibraryTst = {
initialize: function (callback) {
callback = Runtime.getFuncWrapper(callback, 'vi')
var numBytes = 2 * Float32Array.BYTES_PER_ELEMENT
var ptr = Module._malloc(numBytes)
try {
callback(ptr)
@Sciss
Sciss / build.sbt
Created September 1, 2019 12:44 — forked from markehammons/build.sbt
Packaging your application with a minimized runtime courtesy of jlink
import java.io.{ByteArrayOutputStream, PrintWriter}
import java.util.spi.ToolProvider
enablePlugins(JavaAppPackaging)
//this allows us to run tools like jdeps and jlink from within the JVM
def runTool(name: String, arguments: Seq[String]): Either[String,String] = {
val maybeTool: Option[ToolProvider] = {
val _tool = ToolProvider.findFirst(name)
if(_tool.isPresent) {
@Sciss
Sciss / sipiradio.py
Created September 10, 2017 17:08 — forked from JonathanThorpe/sipiradio.py
Si473x i2c/i2s radio for Rasperrby Pi
#!/usr/bin/python3
import quick2wire.i2c as i2c
import time
import RPi.GPIO as GPIO
import alsaaudio
import threading
import logging
import sys
#Work in progress library for Si473x for Raspberry Pi by Jonathan Thorpe <jt@jonthorpe.net>
@Sciss
Sciss / Macros.scala
Created August 31, 2017 14:47 — forked from pedrofurla/Macros.scala
Example of how to get source locations using scala macros
package slickdemo
import scala.reflect.macros.Context
import scala.language.experimental.macros
object Macros {
// scala.reflect.runtime.currentMirror
// universe.reify
@Sciss
Sciss / Monte Carlo simulation of the 2D Potts model - Part 2.ipynb
Created August 14, 2017 19:05 — forked from genkuroki/Monte Carlo simulation of the 2D Potts model - Part 2.ipynb
Julia/Ising/Monte Carlo simulation of the 2D Potts model - Part 2.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Sciss
Sciss / audio_lstm_samplernn_keras.ipynb
Created May 13, 2017 06:24 — forked from naotokui/audio_lstm_samplernn_keras.ipynb
Audio generation with LSTM. inspired by SampleRNN architecture (work in progress)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Sciss
Sciss / min-char-rnn.py
Created June 4, 2016 09:47 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@Sciss
Sciss / FXMorphing.java
Created February 27, 2016 01:24 — forked from gontard/FXMorphing.java
JFX 2 : morphing 2D Transition. The FXMorphing class is an application thats demonstrate how to use the Morphing2D Transition.
import javafx.animation.Interpolator;
import javafx.animation.Transition;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
import javafx.scene.shape.Ellipse;
import javafx.scene.shape.Rectangle;
import javafx.scene.shape.Shape;
import javafx.stage.Stage;
import javafx.util.Duration;
@Sciss
Sciss / about:config.md
Last active September 14, 2015 23:22 — forked from haasn/about:config.md
Firefox bullshit removal via about:config

Firefox bullshit removal

Due to the incessant swarm of complete and utter nonsense that has been forcing its way into Firefox over time, I've decided to start collecting my personal list of “must-have” about:config tweaks required to turn Firefox into a functional brower.

WebSockets

These can be used for nefarious purposes and to bypass access restrictions.

network.websocket.enabled=false