Skip to content

Instantly share code, notes, and snippets.

@rpivo
rpivo / index.md
Last active May 1, 2024 19:54
Encrypting & Decrypting Sensitive Data With the Web Crypto API

Encrypting & Decrypting Sensitive Data With the Web Crypto API

Chris Veness created a really great gist that shares code to encrypt and decrypt data using the Web Crypto API here.

This gist breaks down the code in that gist step by step, detailing a real-world scenario with actual data.

It might be helpful to have that gist open in another tab and use this gist to walk through each line of code.

One interesting use case for this would be to encrypt on a client, and then decrypt in the cloud with something like a Lambda function. In order to do this, you could use Node's latest version as of this gist, version 15, which includes a webcrypto module that's designed to be a Node implementation of the Web Crypto API. Lambdas can't use v15 by default -- however, you can create a custom Lambda layer that contains v15.

{"version":3,"sources":["app/public/scss/style.css"],"names":["'UTF-8'","url(","'https://fonts.googleapis.com/css?family=Montserrat:400,700'","/*!\n * Font Awesome 4.7.0 by @davegandy - http://fontawesome.io - @fontawesome\n * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)\n */","/* FONT PATH\n * -------------------------- */","@font-face ","font-family","'FontAwesome'","src","'../fonts/fontawesome-webfont.eot?v=4.7.0'","'../fonts/fontawesome-webfont.eot?#iefix&v=4.7.0'","format(","'embedded-opentype'","'../fonts/fontawesome-webfont.woff2?v=4.7.0'","'woff2'","'../fonts/fontawesome-webfont.woff?v=4.7.0'","'woff'","'../fonts/fontawesome-webfont.ttf?v=4.7.0'","'truetype'","'../fonts/fontawesome-webfont.svg?v=4.7.0#fontawesomeregular'","'svg'","font-weight","normal","font-style",".fa","display","inline-block","font","14","px","/","1","FontAwesome","font-size","inherit","text-rendering","auto","-webkit-font-smoothing","antialiased","-moz-osx-font-smoothing","grayscale","/* makes th
(async function () {
const IN = "10:00";
const OUT = "18:00";
const OFFSET = 10;
const rand = (n) => n - Math.floor(Math.random() * (2 * n + 1));
const offsetHour = (h, o) => {
let [hh, mm] = h.split(":");
hh = Number(hh);
{"version":3,"file":"style.css","sources":["style.scss","../web_modules/font-awesome/scss/font-awesome.scss","../web_modules/font-awesome/scss/_variables.scss","../web_modules/font-awesome/scss/_mixins.scss","../web_modules/font-awesome/scss/_path.scss","../web_modules/font-awesome/scss/_core.scss","../web_modules/font-awesome/scss/_larger.scss","../web_modules/font-awesome/scss/_fixed-width.scss","../web_modules/font-awesome/scss/_list.scss","../web_modules/font-awesome/scss/_bordered-pulled.scss","../web_modules/font-awesome/scss/_animated.scss","../web_modules/font-awesome/scss/_rotated-flipped.scss","../web_modules/font-awesome/scss/_stacked.scss","../web_modules/font-awesome/scss/_icons.scss","../web_modules/font-awesome/scss/_screen-reader.scss","utilities/_normalize.scss"],"sourcesContent":["\n//Fonts\n@import url('https://fonts.googleapis.com/css?family=Montserrat:400,700');\n\n//Modules\n@import '../web_modules/font-awesome/scss/font-awesome';\n@import 'utilities/normalize';\n\n//Generic\n\nbody {\n
@denji
denji / nginx-tuning.md
Last active May 1, 2024 19:53
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@dvf
dvf / change-codec.md
Last active May 1, 2024 19:52
Enable High Quality mode on your headphones (Updated for macOS Catalina)

If you're using a high-end bluetooth headset on your Macbook Pro it's likely your mac is using an audio codec which favors battery efficiency over high quality. This results in a drastic degradation of sound, the SBC codec is the likely culprit, read more about it here.

Find out what codec you're using

  1. Play a song on your headphones
  2. Option (⌥) click the Bluetooth button at the top of your screen Inspect the Bluetooth Coded
  3. If you're using AAC or aptX, you can stop here—those are the highest quality codecs.

Change your codec to AAC or aptX

https://zuomod.com/Umea-Arm-Chair-Iron-Gray?search=500341
https://zuomod.com/Umea-Arm-Chair-Island-Blue?search=500342
https://zuomod.com/Graham-End-Table-Walnut?search=101059
https://zuomod.com/Fashion-Counter-Chair-Stone-Gray?search=100646
https://zuomod.com/Fashion-Counter-Chair-White?search=100647
https://zuomod.com/Homestead-Lounge-Chair-White-Pu?search=100766
https://zuomod.com/Quilt-Armless-Dining-Chair-Black?search=100187
https://zuomod.com/Quilt-Armless-Dining-Chair-White?search=100188
https://zuomod.com/Quilt-Dining-Chair-Black?search=100189
https://zuomod.com/Quilt-Dining-Chair-White?search=100190
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
@ElenaMLopez
ElenaMLopez / consola-linux.md
Last active May 1, 2024 19:51
Comandos de la consola de linux

Información del sistema

  1. arch: mostrar la arquitectura de la máquina (1).
  2. uname -m: mostrar la arquitectura de la máquina (2).
  3. uname -r: mostrar la versión del kernel usado.
  4. dmidecode -q: mostrar los componentes (hardware) del sistema.
  5. hdparm -i /dev/hda: mostrar las características de un disco duro.
  6. hdparm -tT /dev/sda: realizar prueba de lectura en un disco duro.
  7. cat /proc/cpuinfo: mostrar información de la CPU.
  8. cat /proc/interrupts: mostrar las interrupciones.
@candekn
candekn / PokemonTP_.idea_Pokemon.iml
Created May 2, 2019 19:37
TP2 de Programacion Web 2: Realizar una web que represente una Pokedex (listado de pokémon) y permita realizar búsqueda sobre la misma.
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="jquery" level="application" />
</component>
</module>