Skip to content

Instantly share code, notes, and snippets.

@Sciss
Sciss / WordCountTeXShop.md
Created May 1, 2012 10:06
Enable Word Count in TeXShop

Word counting questions almost always lead to statements about its impossibility and/or uselessness. However, if you use TeXShop there is an engine for counting words (texcount) in the ~/Library/TeXShop/Inactive/texcount folder. Drag either of the engines out of its folder into the Engines folder, and you can use that to count words. To use it, choose it as the engine and then "typeset" the document. It will open a web summary of the counts and how it did it. It works off of the latex source, but is pretty good for most things.

From comp.tex.macosx

@Sciss
Sciss / binarytree.gvpr
Created June 6, 2012 00:04
GraphViz formatting script for binary trees
// from Emden Gansner
// https://mailman.research.att.com/pipermail/graphviz-interest/2010q2/007101.html
// requires GraphViz 2.28.0 (fails with 2.26.3 at least)
BEGIN {
double tw[node_t]; // width of tree rooted at node
double nw[node_t]; // width of node
double xoff[node_t]; // x offset of root from left side of its tree
double sp = 36; // extra space between left and right subtrees
double wd, w, w1, w2;
double x, y, z;
var funStartStopMedia = function() {
console.log("play/stop");
var sl = Reveal.getCurrentSlide();
var e = sl.getElementsByTagName("audio")[0];
if (typeof e == 'undefined') {
e = sl.getElementsByTagName("video")[0];
};
if (typeof e !== 'undefined') {
if (e.paused) {
e.play();
val dirIn = userHome / "Downloads" / "bla"
val pIn = dirIn.children(_.name.endsWith(".html")).sorted(File.NameOrdering)
def getPageFiles(htmlF: File): Seq[File] = {
val dir = htmlF.parent
val in = new java.io.FileInputStream(htmlF)
val arr = new Array[Byte](in.available)
in.read(arr)
in.close()
val html = new String(arr, "UTF-8")
val ocrDir = file("/data/texts/ocr")
def all = ocrDir.children(_.extL == "txt")
// all.size
def findOCR2(words: List[String], contentsMaxChars: Int = 72, maxFileName: Int = 72): Unit =
new Thread {
override def run(): Unit = {
all.sorted(File.NameOrdering).foreach { f =>
// println(f.name)
val fIn = new java.io.FileInputStream(f)
[error] scala.MatchError: Literal(Constant(null)) (of class dotty.tools.dotc.ast.Trees$Literal)
[error] at dotty.tools.dotc.ast.tpd$.TypeApply(tpd.scala:54)
[error] at dotty.tools.dotc.ast.tpd$TreeOps$.appliedToTypeTrees$extension(tpd.scala:951)
[error] at dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:3896)
[error] at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:3251)
[error] at dotty.tools.dotc.typer.ProtoTypes$FunProto.typedArg(ProtoTypes.scala:433)
[error] at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:853)
[error] at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:853)
[error] at dotty.tools.dotc.typer.Applications$Application.addTyped$1(Applications.scala:544)
[error] at dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:609)

In order to build SuperCollider 3.6.5 from source on Linux (Debian), the following steps were necessary on a fresh system:

sudo apt-get install build-essential
sudo apt-get install cmake
sudo apt-get install libfftw3-dev
sudo apt-get install libqt4-dev
sudo apt-get install libqtwebkit-dev
sudo apt-get install libjack-jackd2-dev
sudo apt-get install libsndfile1-dev
val s = "978-3-9504622-3-"
val s0 = s.filter(_.isDigit)
val u = (s0 zip Iterator.continually(Seq(1, 3)).flatten).map { case (c, m) => c.toString.toInt * m } .sum
val v = u.roundUpTo(10)
val p = v - u // 4
s ++ p.toString // "978-3-9504622-3-4"
import osc.Implicits._
val c = osc.UDP.Client(localhost -> 17737)
var marks = Vector.empty[Long]
c.action = {
case osc.Message("/query.reply", 1, count: Int) =>
c ! osc.Message("/doc/active/markers", "get", 2, "range", 0, count)
case osc.Message("/get.reply", 2, info @ _*) =>
marks = info.sliding(1, 2).flatten.collect {

Overview

Here are my notes from 2009, sent to sc-users:

What is needed is a new NRT mode that

  • sets up a normal OSC socket for scsynth
  • so awaits OSC messages and replies with OSC messages (/n_go, /n_end, /done ..., /synced, /tr, ... )
  • but advances in time as fast as possible but with input from sclang