Skip to content

Instantly share code, notes, and snippets.

@Sciss
Sciss / gist:1995057
Created March 7, 2012 18:44 — forked from ryo1kato/gist:1949096
SSH key fingerprint
require 'base64'
require 'digest/md5'
ssh_pubkey='AAAAB3NzaC1yc2EAAAABIwAAAQEAxCw2nrIcdQ+7/tKy+6fk1qmICpl2qa8jxCLoG3pnGniDUUIOtRdEfnpHNHYWfwBVYIdGD5bmcFnXEfoxRjR2VpLXNeY/8PlCG5lARuQqkc720ZfoxsEQo3m+ixV4ylbuQfo8eDrELrn+MWiPluh699lWyvgZ/6oTW1nf2gsKabG+nV8uLvr7Znr230S8o8vhgo6O3cmfLGcfApUnG9kce1YOlz1D9F2x6vzDSO2W3s5/UTBmDvLj3Cza+yzmLp2fzAw97FL6LLwS2cLaVUayc6pZKqN+4Gu9LDPXFl4jkD2xzPTp7cuKdrJFaDsIa0OHzG+yVlDvWi8FkdU9O+xiuw=='
fingerprint = Digest::MD5.hexdigest(Base64.decode64(ssh_pubkey)).scan(/../).join(':')
puts fingerprint
@Sciss
Sciss / sfnet2github.sh
Created April 19, 2012 21:47 — forked from stwalkerster/sfnet2github.sh
SourceForge.net svn repo to github git repo import script

Licence (MIT Licence)

Copyright (c) 2011 Simon Walker

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

@Sciss
Sciss / macro-ret.scala
Created July 2, 2012 17:00 — forked from retronym/macro-ret.scala
macro with computed return type
scala> def retImpl(c: Context)(b: c.Expr[Boolean]): c.Expr[Any] = {
| import c.universe._
| val Literal(Constant(bool: Boolean)) = b.tree
| if (bool) c.reify(0) else c.reify(false)
| }
retImpl: (c: scala.reflect.makro.Context)(b: c.Expr[Boolean])c.Expr[Any]
scala> def ret(b: Boolean) = macro retImpl
ret: (b: Boolean)Any
// libraryDependencies += "net.databinder.dispatch" %% "dispatch-core" % "0.9.4"
import dispatch._
val q = url("http://www.freesound.org/api/sounds/search")
.addQueryParameter("q", "barking")
.addQueryParameter("api_key", "074c0b328aea46adb3ee76f6918f8fae")
val p = Http.configure(_ setFollowRedirects true)(q OK as.String)
p() // -> this needs to be fed into a JSON parser
// does this work out?
trait Txn[S <: Sys] {
def newVar[A](init: A): S#Vr[A]
}
trait Var[Tx, A] {
def get(implicit tx: Tx): A
def set(value: A)(implicit tx: Tx): Unit
}
/* We've run into a few common pitfalls when dealing with Futures in Scala, so I wrote these three helpful
* classes to give some baked-in functionality.
*
* I'd love to hear about other helpers you're using like these, or if you have improvement suggestions.
* github@andrewconner.org / @connerdelights
*/
import scala.concurrent.{ExecutionContext, CanAwait, Awaitable, Future, Promise}
import scala.concurrent.duration.Duration
// import de.sciss.file._
val fmtIn = new java.text.SimpleDateFormat("'B'HH'h'mm'm'ss's'ddMMMyyy'.wav'")
val fmtOut = new java.text.SimpleDateFormat("yyMMdd_HHmmss'.wav'")
def rename(dir: File, prefix: String): Unit = {
require(dir.isDirectory)
dir.children.foreach { fIn =>
try {
val date = fmtIn.parse(fIn.name)
@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
@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 / 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)