Skip to content

Instantly share code, notes, and snippets.

View pladaria's full-sized avatar
👾

Pedro Ladaria pladaria

👾
View GitHub Profile
@pladaria
pladaria / index.js
Created January 30, 2019 09:47
generate-vapid-keys created by pladaria - https://repl.it/@pladaria/generate-vapid-keys
const crypto = require('crypto');
const urlBase64 = require('urlsafe-base64');
function generateVAPIDKeys() {
const curve = crypto.createECDH('prime256v1');
curve.generateKeys();
return {
publicKey: urlBase64.encode(curve.getPublicKey()),
privateKey: urlBase64.encode(curve.getPrivateKey())
@pladaria
pladaria / sentry-webpack-plugin.js
Created November 24, 2017 10:53
Sentry artifacts upload plugin for webpack
/*
* Original file:
* https://github.com/40thieves/webpack-sentry-plugin/blob/master/src/index.js
*/
const request = require('request-promise');
const fs = require('fs');
const crypto = require('crypto');
const {green, yellow, red} = require('colors/safe');
const Queue = require('promise-queue');
@pladaria
pladaria / index.js
Last active April 22, 2017 10:54
requirebin sketch
const RWS = require('reconnecting-websocket');
const rws1 = new RWS('wss://echo.websocket.org');
const rws2 = new RWS('wss://echo.websocket.org', undefined);
rws1.onopen = () => console.log('ws1 connected');
rws2.onopen = () => console.log('ws2 connected');
@pladaria
pladaria / nginxproxy.md
Created February 11, 2017 18:34 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@pladaria
pladaria / run_ez4_client_with_wine.md
Last active August 21, 2016 13:31
Open EZ4_client with wine

Run EZ4 Client with wine

To transfer GBA Roms to SD for EZ-Flash IV

  1. Open wine config and set your SD drive as D:
  2. Install Winetricks
  3. Using Winetricks install MFC42
  4. You should now be able to run EZ4_client

Problems with names when transfering roms? Check this.

@pladaria
pladaria / websocket-reconnect.js
Last active June 27, 2016 17:47
Quick and dirty draft of a reconnecting websocket with connecting timeout
/**
* Quick and dirty draft of a reconnecting websocket with connecting timeout
*/
console.debug('script init')
const MAX_RECONNECTION_DELAY = 8000
const MIN_RECONNECTION_DELAY = 1500
const CONNECTING_TIMEOUT = 5000