This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Wire.h> | |
#include <LiquidCrystal_I2C.h> | |
LiquidCrystal_I2C lcd(0x27, 20, 4); | |
int loopCtr = 0; | |
int direction = 0; | |
int x = random(0, 13); | |
int y = random(0, 1); | |
int dx = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import matplotlib.pyplot as plt | |
# Define your apps and their source directories | |
dirs = { | |
"App 1": "/path/to/app1/", | |
"App 2": "/path/to/app2/", | |
"App 3": "/path/to/app3/" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import random | |
import os | |
import math | |
buses_names = ["CONDOR", "PLUSMAR", "RAPIDO", "FLECHA"] | |
def clear_console(): | |
os.system('cls' if os.name == 'nt' else 'clear') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Tic Tac Toe</title> | |
<meta name="description" content="Tic Tac Toe game"> | |
<meta name="author" content="Matias Micheletto"> | |
</head> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const imgResize = (base64, factor) => { | |
return new Promise((resolve, reject) => { | |
const watchdog = setTimeout(()=>{ | |
reject(new Error("TIMEOUT")); | |
}, 5000); // If image loading takes too long | |
const canvas = document.createElement("canvas"); | |
const img = new Image(); | |
img.onload = function () { | |
clearTimeout(watchdog); | |
canvas.width = Math.round(img.width*factor); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Recursively count the total number of lines of code in .js and .jsx files found in a directory. | |
find . -name '*.js' -o -name '*.jsx' | xargs wc -l |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const hash = message => { | |
return new Promise((resolve, reject) => { | |
const msgBuffer = new TextEncoder().encode(message); | |
crypto.subtle.digest('SHA-256', msgBuffer) | |
.then(hashBuffer => { | |
const hashArray = Array.from(new Uint8Array(hashBuffer)); | |
const hexString = hashArray.map(b => b.toString(16).padStart(2, '0')).join(''); | |
const str = hexString | |
.replace(/\r|\n/g, "") | |
.replace(/([\da-fA-F]{2}) ?/g, "0x$1 ") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const haversine = (pos1, pos2) => { | |
// https://stackoverflow.com/questions/639695/how-to-convert-latitude-or-longitude-to-meters | |
const R = 6378.137; // Radius of Earth | |
const dLat = pos2.lat * Math.PI / 180 - pos1.lat * Math.PI / 180; | |
const dLon = pos2.lng * Math.PI / 180 - pos1.lng * Math.PI / 180; | |
const a = Math.sin(dLat/2) * Math.sin(dLat/2) + | |
Math.cos(pos1.lat * Math.PI / 180) * Math.cos(pos2.lat * Math.PI / 180) * | |
Math.sin(dLon/2) * Math.sin(dLon/2); | |
return (R * 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a))); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<!-- Título de la página, visible en la barra del navegador --> | |
<title>Método Monte Carlo en el navegador</title> | |
</head> | |
<body> | |
<div style="margin:15px;"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const frame = [ | |
["\n\n\n\n","ROFL:ROFL:LOL\n"," ___^_____\n"," L __/ [] \\\n"," O === \\\n"," L \\____________]\n"," I I\n"," ------------/\n"], | |
["\n\n\n\n"," :LOL:ROFL:ROFL\n"," ___^_____\n"," __/ [] \\\n","LOL=== \\\n"," \\____________]\n"," I I\n"," ------------/\n"] | |
]; | |
let index=0; | |
setInterval(()=>{ | |
console.clear(); | |
console.log(frame[(index++)%2].join(' '.repeat(index))); | |
}, 100); |
NewerOlder