Skip to content

Instantly share code, notes, and snippets.

View diegodorado's full-sized avatar

Diego Dorado diegodorado

View GitHub Profile
@diegodorado
diegodorado / convert-for-web.sh
Created April 28, 2021 12:01
Convert jpg images optimized for web
for f in IMG*; do convert $f -sampling-factor 4:2:0 -strip -quality 85 -interlace JPEG -colorspace RGB "s-$f";done;
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';
FLUSH PRIVILEGES;
@diegodorado
diegodorado / v4l2loopback.sh
Created April 7, 2021 14:32
Enable virtual cameras
sudo modprobe v4l2loopback video_nr=2 card_label="OBS Virtual Camera"
@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 / 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
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
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
{
#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
//
// 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
@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