Skip to content

Instantly share code, notes, and snippets.

@baubyte
baubyte / app.html
Created July 31, 2024 17:38 — forked from derekchiang/app.html
[electron]Use electron as a Web Server
<!doctype html>
<html><head><script src="app.js"></script></head><body></body></html>
@baubyte
baubyte / self-certificates.sh
Created July 7, 2024 21:51 — forked from Klerith/self-certificates.sh
Generar certificados
openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout server.key -out server.crt
@baubyte
baubyte / configurar-node-ts.md
Created May 27, 2024 22:38 — forked from Klerith/configurar-node-ts.md
Node con TypeScript - TS-Node-dev simplificado

Node con TypeScript - TS-Node-dev (preferido)

  1. Instalar TypeScript y demás dependencias
npm i -D typescript @types/node ts-node-dev rimraf
  1. Inicializar el archivo de configuración de TypeScript ( Se puede configurar al gusto)
npx tsc --init --outDir dist/ --rootDir src
@baubyte
baubyte / pasos-node-ts-jest.md
Created May 22, 2024 16:15 — forked from Klerith/pasos-node-ts-jest.md
Note + TypeScript + Jest = Testing

Pasos para configurar Jest con TypeScript, en Node

Documentación oficial sobre Jest

  1. Instalaciones de desarrollo (super test es útil para probar Express)
npm install -D jest @types/jest ts-jest supertest

Pasos para usar Node alias con TypeScript

  1. Instalar tsconfig-paths, como dependencia de desarrollo
npm install -D tsconfig-paths
  1. Instalar tsc-alias, como dependencia de desarrollo. Nos va ser util para ejecutar los scripts
npm i -D tsc-alias
@baubyte
baubyte / pasos-node-typescript.md
Created May 21, 2024 00:34 — forked from Klerith/pasos-node-typescript.md
Configurar proyecto de Node con TypeScript

Pasos para usar Node con TypeScript con Nodemon

Más información - Docs Oficiales

  1. Instalar TypeScript y tipos de Node, como dependencia de desarrollo
npm i -D typescript @types/node
  1. Inicializar el archivo de configuración de TypeScript ( Se puede configurar al gusto)
@baubyte
baubyte / jwt_decode.php
Created March 1, 2024 16:49 — forked from ahgood/jwt_decode.php
Get payload data from JWT token.
<?php
/**
* JSON Web Token implementation
*
* Minimum implementation used by Realtime auth, based on this spec:
* http://self-issued.info/docs/draft-jones-json-web-token-01.html.
*
* @author Neuman Vong <[email protected]>
*/
class JWT
public function phpRule_ValidarRut($rut) {
// Verifica que no esté vacio y que el string sea de tamaño mayor a 3 carácteres(1-9)
if ((empty($rut)) || strlen($rut) < 3) {
return array('error' => true, 'msj' => 'RUT vacío o con menos de 3 caracteres.');
}
// Quitar los últimos 2 valores (el guión y el dígito verificador) y luego verificar que sólo sea
// numérico
$parteNumerica = str_replace(substr($rut, -2, 2), '', $rut);
@baubyte
baubyte / letteravatar.js
Created December 20, 2023 20:16 — forked from vctrfrnndz/letteravatar.js
Generate SVG letter avatar
function drawCircle(text, size, color) {
var textSize = Math.ceil(size / 2.5);
var font = 'Proxima Nova, proxima-nova, HelveticaNeue-Light, Helvetica Neue Light, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif';
var colors = ["#1abc9c", "#16a085", "#f1c40f", "#f39c12", "#2ecc71", "#27ae60", "#e67e22", "#d35400", "#3498db", "#2980b9", "#e74c3c", "#c0392b", "#9b59b6", "#8e44ad", "#bdc3c7", "#34495e", "#2c3e50", "#95a5a6", "#7f8c8d", "#ec87bf", "#d870ad", "#f69785", "#9ba37e", "#b49255", "#b49255", "#a94136"];
var colorIndex = Math.floor((text.charCodeAt(0) - 65) % colors.length);
var finalColor = color || colors[colorIndex];
var template = [
'<svg height="' + size + '" width="' + size + '" style="background: ' + finalColor + '">',
'<text text-anchor="middle" x="50%" y="50%" dy="0.35em" fill="white" font-size="' + textSize + '" font-family="' + font + '">' + text.toUpperCase() + '</text>',
@baubyte
baubyte / GoogleDorking.md
Created November 30, 2023 00:19 — forked from sundowndev/GoogleDorking.md
Google dork cheatsheet

Google dork cheatsheet

Search filters

Filter Description Example
allintext Searches for occurrences of all the keywords given. allintext:"keyword"
intext Searches for the occurrences of keywords all at once or one at a time. intext:"keyword"
inurl Searches for a URL matching one of the keywords. inurl:"keyword"
allinurl Searches for a URL matching all the keywords in the query. allinurl:"keyword"
intitle Searches for occurrences of keywords in title all or one. intitle:"keyword"