Skip to content

Instantly share code, notes, and snippets.

View diegovgsilva95's full-sized avatar

Diego Silva diegovgsilva95

  • Jundiaí, Sao Paulo, Brazil
  • 12:48 (UTC -03:00)
View GitHub Profile
@diegovgsilva95
diegovgsilva95 / index.htm
Created May 10, 2024 19:31
Experimentation with randomness: Spray-style brownian art
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Brownian Art</title>
</head>
<body>
<canvas></canvas>
<img src="img.jpg" alt="" style="display: none;">
@diegovgsilva95
diegovgsilva95 / index.mjs
Created May 9, 2024 13:00
Experimentation with camera noise randomness: transforming camera image intensity into "random" words
function mapNumber(v, fn, fx, tn, tx, constrain = true){
if(fx == fn)
return v < fn ? tn : tx;
v = (v - fn) / (fx - fn);
if(constrain)
v = Math.min(1, Math.max(0, v));
return ((v * (tx - tn)) + tn);
@diegovgsilva95
diegovgsilva95 / index.mjs
Created May 9, 2024 12:57
Monitoring of IP Address renewing (leasing) using Node.js
import { spawn } from "child_process"
import { log } from "console"
import { appendFile } from "fs/promises"
import {stdout} from "process"
var sleep = ms => new Promise(r => setTimeout(r, ms))
const getMyIP = async function(){
return new Promise((res, rej)=>{
let timeout = 500
let timeoutHandler = () => rej(Error("Timeout"))
@diegovgsilva95
diegovgsilva95 / sample.mjs
Created May 6, 2024 22:29
Comparing UI Libraries: guify, Dat.GUI, and Tweakpane
// guify:
var gui = new guify({
root: elm,
width: "100%",
panelOverflowBehavior: "overflow",
barMode: "none"
});
gui.Register([{
type: 'text', label: "foo",
@diegovgsilva95
diegovgsilva95 / index.mjs
Created May 3, 2024 18:25
Binary-concatenation sequence and Audio Experiment
const byteseq_array = {
seq: [],
rem: "",
reset(){
this.seq = []
this.rem = ""
},
nextIteration(){
if(this.seq.length == 0){
this.seq.unshift(0)
@diegovgsilva95
diegovgsilva95 / index.userscript.mjs
Last active January 24, 2024 20:15
Tumblr - Remove ads using userscript (proof-of-concept)
function removeContainer(x){
let elmRemv = x.parentElement, i = 0
while(!elmRemv.dataset.cellId){
if(++i > 10){
i = 1000
break;
}
elmRemv = elmRemv.parentElement
}
@diegovgsilva95
diegovgsilva95 / index.css
Created January 12, 2024 14:41
Sacred Geometry - Grid Generator
*, *::before, *::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html, body {
height: 100%;
}
body {
background-color: #222;
@diegovgsilva95
diegovgsilva95 / README.md
Created January 9, 2024 16:12
Whatsapp Web - Dark Red Theme CSS generator

Overview

Originally created by myself and for myself, this Node.js script generates CSS rules for WhatsApp Web, converting the standard dark colors to their red tones, effectively making WhatsApp Web red. I'm sharing this, should it be useful to someone else. Use at your own risk.

Requirements

  • chroma.js (npm i chroma-js)
  • Some userscript extension at the browser (such as TamperMonkey)

Steps

  1. Open WhatsApp Web at the browser
@diegovgsilva95
diegovgsilva95 / index.mjs
Created December 19, 2023 17:19
Yin-Yang Drawing
var canvas = document.querySelector("canvas"),
ctx = canvas.getContext("2d"),
H = canvas.height = 720,
W = canvas.width = 16*H/9,
CX = W/2,
CY = H/2,
R = (Math.min(CX,CY)) * 0.95
var drawYinYang = function(cx, cy, r){
@diegovgsilva95
diegovgsilva95 / setup.sh
Created December 15, 2023 03:28
My Arch Linux Setup procedures (backed up as self-reference for my future installations)
# THIS CODE IS NOT INTENDED TO RUN DIRECTLY VIA SHELL INTERPRETERS, INSTEAD, DO STEP-BY-STEP MANUALLY.
# THIS CODE IS NOT INTENDED TO RUN DIRECTLY VIA SHELL INTERPRETERS, INSTEAD, DO STEP-BY-STEP MANUALLY.
# THIS CODE IS NOT INTENDED TO RUN DIRECTLY VIA SHELL INTERPRETERS, INSTEAD, DO STEP-BY-STEP MANUALLY.
loadkeys br-abnt2 # My keyboard is Brazilian
### Stage 1: enable SSHing during installation
ip addr
vim /etc/ssh/sshd_config