Skip to content

Instantly share code, notes, and snippets.

View diegodorado's full-sized avatar

Diego Dorado diegodorado

View GitHub Profile
let ns pp = note (scale "spanish" $ pp)
pat = "[0 3 4]/12"
nseg ss pp = (round <$> (segment ss $ pp))
nss ss pp = ns (nseg ss pp)
pats =
[
("intro", nss 6 (range 0 "<12 8>" $ sine+0.2*rand) # midi 5),
("intro2", nss (2 * irand 4) (range 0 "<12 8>" $ sine+0.2*rand) # midi 5),
("intro3", nss (2 * irand 4) (range 0 "<12 8>" $ sine+0.2*rand) + stack[midi 5,midi 0 -note 12]),
("bridge", nss (choose([1,3,6,12])) (sine*12+rand*3) + stack[midi 5,midi 0 -note 12]),
# how to pair a fucking bluetooth keyboard
# first, make sure bluetooth service is on
# then, enter bluetoothctl
bluetoothctl
#just in case
power on
#filter keyboards
agent KeyboardOnly
@diegodorado
diegodorado / marching-cubes.js
Created August 12, 2020 17:40
hydra+p5+webgl
try{p.remove()}catch{}
p = new P5({mode:'WEBGL'}) // start again
d = 10
w =200
d2 = d*d
q = Array.from({length: d2}, () => Math.random())
l = Array.from({length: d}, () => Math.round(Math.random()*d2))
p.draw = () => {
let t = p.millis()/1000
t *=2
//
// defino mis variables
let cc = Array(128).fill(0)
let notes = Array(128).fill(0)
let lastCc = 0
let lastNote = 0
let lastOctave = 0
let lastRelNote = 0
//
// declaro un handler de eventos midi
#ifdef _WIN32
// taken from https://stackoverflow.com/questions/28027937/cross-platform-sockets
/* See http://stackoverflow.com/questions/12765743/getaddrinfo-on-win32 */
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0501 /* Windows XP. */
#endif
#include <winsock2.h>
#include <ws2tcpip.h>
#pragma comment(lib,"ws2_32.lib") //Winsock Library
#else
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using System.Net;
using System.Net.Sockets;
using System.Text;
public class UDPClient : MonoBehaviour
{
Node:
position: (x,y,z)
G_cost = INFINITY // costo local
H_cost = INFINITY // distancia heuristica
F_cost = () => G_cost + H_cost
neighbors = [] // vecinos
is_walkable = true
is_closed = false
@diegodorado
diegodorado / WP_Dockerfile
Last active March 27, 2021 19:59
Wordpress Dockerfile for small sites
ARG WORDPRESS_DB_HOST
ARG WORDPRESS_DB_NAME
ARG WORDPRESS_TABLE_PREFIX
ARG WORDPRESS_DB_USER
ARG WORDPRESS_DB_PASSWORD
FROM wordpress:5.7
# Don't run mpm for small sites
RUN sed -i 's/Servers.*/Servers 1/' /etc/apache2/mods-available/mpm_prefork.conf
@diegodorado
diegodorado / stream_android_screen.md
Created April 7, 2021 14:31
How to get wirelessly your android screen on your desktop

Connect your device through usb and enable adb over TCP/IP: adb tcpip 5555

  1. Connect the device to the same Wi-Fi as your computer
  2. Get your device IP address (in Settings → About phone → Status)
  3. Connect to your device: adb connect DEVICE_IP:5555
  4. Run scrcpy

To switch back to USB mode: adb usb.

@diegodorado
diegodorado / v4l2loopback.sh
Created April 7, 2021 14:32
Enable virtual cameras
sudo modprobe v4l2loopback video_nr=2 card_label="OBS Virtual Camera"