Skip to content

Instantly share code, notes, and snippets.

@Sciss
Sciss / mkpdf.sh
Created April 24, 2015 12:09
Make a clean build via pdflatex, including biblatex and nomenclature
#!/bin/bash
echo ":::: CLEAN BUILD OF $1 ::::"
cd "$(dirname "$0")" # go into directory of script
rm -f ${1}.toc
rm -f ${1}.run.xml
rm -f ${1}.out
rm -f ${1}.nlo

Classes

  • java.io.BufferedInputStream
  • java.io.BufferedOutputStream
  • java.io.File
  • java.io.RandomAccessFile
  • java.io.FileInputStream
  • java.util.concurrent.ScheduledExecutorService
  • java.util.concurrent.ScheduledFuture
  • java.util.concurrent.Executors
@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)
val OVR = 6
val F = OVR * 8
val SR = 48000.0
val mod1 = LFSaw(111.1 / (SR * OVR)).linLin(-1, 1, 10, 40)
val mod2 = LFSaw( 11.1 / (SR * OVR)).linLin(-1, 1, 190, 720)
val mod3 = LFSaw( 22.2 / (SR * OVR)).linLin(-1, 1, 11, 42)
val h = TrigHold(Metro(mod3 * F), (ArithmSeq(4, 1) % mod1) * F, Metro(mod2 * F))
val r = Resample(h, factor = 1.0/OVR) * 0.8
val l = LeakDC(r).drop(300)
//Plot1D(l, 400)
// output of 'sbt dependencyTree'
val e = scala.io.Source.fromFile(userHome/"Downloads"/"dep.txt")
.getLines.toList.filter(_.contains("+-de.sciss"))
.map { ln =>
val i = ln.indexOf("+-") + 2
val j = ln.indexOf(" ", i)
val k = ln.lastIndexOf(":", if (j < 0) ln.length else j)
ln.substring(i, k)
}
.sorted.distinct
#!/bin/bash
# Copyright (C) InnoviData GmbH <http://www.innovidata.com>, 2011.
# Author: Holger Widmann <holger.widmann@innovidata.com>
# Version: 1.2.20110610
#
# License:
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License (LGPL) as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
// midiRatio( 10.5) shouldBe 1.8340080864049 +- eps
val fIn = file("/home/hhrutz/Documents/devel/Numbers/src/test/scala/de/sciss/numbers/DoubleSpecOLD.scala")
val lnIn = scala.io.Source.fromFile(fIn).getLines.toList
val lnOut = lnIn.map { ln =>
if (ln.contains("shouldBe")) {
val i_eps = ln.indexOf("+-")
val hasEps = i_eps > 0
val t_shd = " shouldBe "
val i_shd = ln.indexOf(t_shd)
val ln1 = if (!hasEps) ln else ln.substring(0, i_eps)
#!/bin/bash
# run this with personal-access-token (repo scope) as argument
# cf. https://stackoverflow.com/questions/53452910/how-to-remove-a-github-environment
env=github-pages
token=$1
repo=Mellite
user=Sciss
if [ $# -eq 0 ]
then
val mainSq = (userHome / "Downloads" / "rb").children(f => f.extL == "pdf" && f.base.startsWith("p-")).sorted(File.NameOrdering)
mainSq.foreach(f => println(f.base))
def runMain(): Unit = {
val out = userHome / "Downloads" / "rb" / "main.pdf"
require (!out.exists())
import scala.sys.process._
val cmd = Seq("pdftk") ++ mainSq.map(_.path) ++ Seq("cat", "output", out.path)
val code: Int = cmd.!
require (code == 0)
val mainSq = (userHome / "Downloads" / "rb").children(f => f.extL == "pdf" && f.base.startsWith("p-")).sorted(File.NameOrdering)
mainSq.foreach(f => println(f.base))
def runMain(): Unit = {
val out = userHome / "Downloads" / "rb" / "main.pdf"
require (!out.exists())
import scala.sys.process._
val cmd = Seq("pdftk") ++ mainSq.map(_.path) ++ Seq("cat", "output", out.path)
val code: Int = cmd.!
require (code == 0)