This file contains 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
/* | |
* Doble generador de onda cuadrada de frecuencia variable | |
*/ | |
// Pines | |
#define T1 2 // Salida 1 | |
#define T2 3 // Salida 2 | |
// Frecuencias por defecto (Hz) | |
#define DEF_1 3 // Salida 1 |
This file contains 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
""" | |
List and plot the top countries with highest number of covid-19 deaths per million people. | |
""" | |
import csv | |
import requests | |
import matplotlib.pyplot as plt | |
This file contains 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" | |
/* If address is not 0x27, then try 0x3F */ | |
LiquidCrystal_I2C lcd(0x27,20,4); | |
/* Custom characters */ | |
byte c0[8] = {0x00,0x00,0x00,0x00,0x01,0x03,0x07,0x0F}; | |
byte c1[8] = {0x04,0x0E,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F}; | |
byte c2[8] = {0x00,0x00,0x00,0x00,0x10,0x18,0x1C,0x1E}; |
This file contains 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
# Check it working on: https://www.kaggle.com/matiasmiche/image-stylization | |
import matplotlib.pyplot as plt | |
import tensorflow_hub as hub | |
import tensorflow as tf | |
import numpy as np | |
import cv2 | |
content_filename = 'content_image.jpg' | |
style_filename = 'style_image.jpg' |
This file contains 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); |
This file contains 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 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 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 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 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); |
OlderNewer