Skip to content

Instantly share code, notes, and snippets.

@brunoro
brunoro / criptogoma.hs
Created July 11, 2020 22:09
beise@criptogoma 2020.07.11
mode = scale "dorian"
d1
$ every 5 (juxBy sine brak)
$ every 3 (jux rev)
$ off 0.125 (|- n 12)
$ n (mode "0 1 3 [5 4]")
# s "kalimba"
# gain 0.8
|- n 12
@brunoro
brunoro / criptogoma.hs
Created July 11, 2020 22:09
beise@criptogoma 2020.07.11
mode = scale "dorian"
d1
$ every 5 (juxBy sine brak)
$ every 3 (jux rev)
$ off 0.125 (|- n 12)
$ n (mode "0 1 3 [5 4]")
# s "kalimba"
# gain 0.8
|- n 12
@brunoro
brunoro / download_playlist.sh
Created June 8, 2017 05:23
Download youtube song playlists
#!/bin/bash
PLAYLIST_URL=$1
youtube-dl \
--yes-playlist --ignore-errors \
--extract-audio --audio-quality 0 --format 'mp3/ogg/m4a/flac/wav' \
--metadata-from-title '%(artist)s - %(title)s' --continue -o '%(playlist)s/%(title)s.%(ext)s' \
$PLAYLIST_URL
@brunoro
brunoro / serbilian.rb
Last active February 25, 2022 13:56
Serbilian cyrilic: a cyrilic script for Brazilian Portuguese based in Serbian Cyrilic
#!/usr/bin/ruby
require 'logger'
require 'pragmatic_tokenizer'
require 'unicode_utils'
class Serbilian
SINGLE_LETTER_WORDS = {
"à" => "a",
"ã" => "ɐ̃",
"â" => "ɐ̃",
@brunoro
brunoro / kv_trie.clj
Last active September 5, 2016 15:59
key-value trie in clojure
(ns kv-trie)
;; adapted from http://stackoverflow.com/questions/1452680/clojure-how-to-generate-a-trie
(defn explode-str [s] (clojure.string/split s #""))
(defn add [trie k v]
"Maps a string key k to any object v"
(let [kchars (explode-str k)]
(assoc-in trie kchars (merge (get-in trie kchars) { :leaf v }))))
@brunoro
brunoro / demons.js
Created September 4, 2016 08:54
canvas demons of cyclic space
var initial_hue = 0.5;
var final_hue = 0.8;
var num_colors = 12;
var scale = 3;
function random_state(width, height) {
var state = [];
for (var h = 0; h < height; h++) {
@brunoro
brunoro / libimobiledevice.rb
Created August 23, 2016 09:47
homebrew formula for libimobiledevice fork
class Libimobiledevice < Formula
desc "Library to communicate with iOS devices natively"
homepage "http://www.libimobiledevice.org/"
head do
url "https://github.com/brunoro/libimobiledevice.git", :using => :git, :revision => '2727fd508145018ce532bf525bd0b5383ce6b1f3'
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
depends_on "libxml2"
@brunoro
brunoro / conflicting_jars.sh
Created August 2, 2016 15:28
Looks for .jar file in a path that conflict with a reference .jar
#!/bin/bash
# Looks for jars in a path that conflicting with a reference jar.
# usage: ./conflicting_jars.sh <reference.jar> <path/to/other/jars>
function abspath() {
# from http://stackoverflow.com/questions/3915040/bash-fish-command-to-print-absolute-path-to-a-file
# generate absolute path from relative path
# $1 : relative filename
# return : absolute path
if [ -d "$1" ]; then
@brunoro
brunoro / BezierCurveNode.h
Created August 20, 2015 15:01
Visualize Bézier curves in cocos2d
#import "cocos2d.h"
@interface BezierCurveNode : CCNode
@property (nonatomic) CGPoint origin;
@property (nonatomic) CGPoint cp1;
@property (nonatomic) CGPoint cp2;
@property (nonatomic) CGPoint destination;
@property (nonatomic) ccColor3B color;
@brunoro
brunoro / kepler-bouwkamp.clj
Last active December 25, 2015 13:39
Draws the inscribed polygons and circles for the prime analog of the Kepler-Bouwkamp constant using Quil.
(ns kepler-bouwkamp.core
(:use quil.core))
(def tau 6.283185307179586)
(defn circle [cx cy r]
"Draws a circle centered at (cx, cy) with radius r."
(let
[d (* r 2)]
(ellipse cx cy d d)))