Skip to content

Instantly share code, notes, and snippets.

View sebadoom's full-sized avatar

Sebastián E. Peyrott sebadoom

View GitHub Profile
var should = require('should'),
userAgentFilter = require('../../lib/userAgentFilter.js');
describe("User Agent Filter logic", function(){
it("should let chrome browser pass", function(done){
var reqMock = {headers: {'user-agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/22.0.1207.1 Safari/537.1'}, url:'/session'};
var resMock = {};
userAgentFilter(reqMock, resMock, function(){
true.should.equal(true);
var should = require('should'),
userAgentFilter = require('../../lib/userAgentFilter.js');
describe("User Agent Filter logic", function(){
it("should let chrome browser pass", function(done){
var reqMock = {headers: {'user-agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/22.0.1207.1 Safari/537.1'}, url:'/session'};
var resMock = {};
userAgentFilter(reqMock, resMock, function(){
true.should.equal(true);
@sebadoom
sebadoom / gist:f0eedcba2f39e3e07a1c
Last active August 29, 2015 14:24
e-voting summary in Buenos Aires
Broad summary:
- Elections are on Sunday 5th, July.
- This is the first time an e-voting system is used in Buenos Aires city.
- Researchers and IT professionals had been warning about potential issues with the way the system works (short summary at the end).
- Government officials have said on-record that the machines are only "printers with no memory". There is video evidence that the machines are in fact standard PCs running Ubuntu. USB and VGA ports are located behind a lid on the side. See videos here: https://storify.com/mis2centavos/el-sistema-de-voto-electronico-usado-en-caba
@sebadoom
sebadoom / console-state.js
Last active March 15, 2017 01:00
Using console.log can change program state.
/* To run:
* mkfifo fifo
* node console-state.js | tee fifo
* Wait 2 seconds, then look for state.json in the same directory.
*/
const fs = require('fs');
const state = [];
@sebadoom
sebadoom / Main.hs
Created April 26, 2017 05:00
Gather forms using wreq and html-conduit
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Network.Wreq
import qualified Text.HTML.DOM as H
import Text.XML
import Text.XML.Cursor
import Control.Lens hiding (element)
import Data.Aeson.Lens
0xA86D1Ec6aC94d4dE92888cFE41C2C9fB33a89dBB
0xA4074CB69fe1cf77E10EF736255AD29AD6036Bc1
@sebadoom
sebadoom / test.js
Created November 10, 2017 15:15
Using node-forge to create valid jwt.io keys
const jwt = require('jsonwebtoken')
const forge = require('node-forge')
const payload = {
hello: 'world'
}
var keypair = forge.rsa.generateKeyPair({ bits: 2048 });
keypair = {
public: forge.pki.publicKeyToPem(keypair.publicKey, 72),