Skip to content

Instantly share code, notes, and snippets.

View pladaria's full-sized avatar
👾

Pedro Ladaria pladaria

👾
View GitHub Profile
@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
@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 / riffwave.js
Created December 7, 2016 16:17
RIFFWAVE
/*
* RIFFWAVE.js v0.03 - Audio encoder for HTML5 <audio> elements.
* Copyleft 2011 by Pedro Ladaria <pedro.ladaria at Gmail dot com>
*
* Public Domain
*
* Changelog:
*
* 0.01 - First release
* 0.02 - New faster base64 encoding
@pladaria
pladaria / .svgo.yml
Last active February 7, 2023 17:15
SVGO config file
multipass: true
plugins:
- addAttributesToSVGElement: false
- addClassesToSVGElement: false
- cleanupAttrs: true
- cleanupEnableBackground: true
- cleanupIDs: true
- cleanupListOfValues: true
- cleanupNumericValues:
@pladaria
pladaria / heroku-deploy.sh
Created January 29, 2017 15:44
Simple shell script to deploy heroku services
#!/usr/bin/env bash
DEPLOY_PATH=/tmp/heroku-deploy-`date +%s`/
HEROKU_NAME="put-your-heroku-service-name-here"
rm -rf $DEPLOY_PATH
mkdir -p $DEPLOY_PATH
rsync -av . $DEPLOY_PATH --exclude node_modules
cd $DEPLOY_PATH
@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 / 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 / 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
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 / fundacion-lectura.md
Last active January 30, 2020 05:52
Saga de la Fundación - Orden de lectura

Saga de la Fundación

Serie de los Robots

  • 1950 Yo, Robot
  • 1954 Bóvedas de Acero
  • 1957 El Sol Desnudo
  • 1983 Los Robots del Amanecer
  • 1985 Robots e Imperio