Skip to content

Instantly share code, notes, and snippets.

View jesuscast's full-sized avatar

Andres Castaneda jesuscast

View GitHub Profile
from nacl.signing import SigningKey, VerifyKey
import base64
import bcrypt
class HashValidationError(Exception):
pass
class KeyPair(object):
def __init__(self, private_key):
# Save the keys.
function testCall() {
return new Promise((resolve, reject) => {
console.log('Get all authentications:');
passbase.getAllAuthentications(params).then(resolve).catch(reject);
});
}
testCall().then(auths => {
console.log(auths)
const axios = require('axios');
async function sendGetRequest(url, secretKey) {
return await axios({
method: 'get',
url: url,
timeout: 5000,
headers: {
'Authorization': secretKey,
'Accept': 'application/json'
@jesuscast
jesuscast / match.py
Last active September 23, 2019 00:43
def findBreakEvenIndex(buyers, sellers):
breakEvenIndex = 0
for i in range(max(len(buyers), len(sellers))):
breakEvenIndex = i
if buyers[i] < sellers[i]:
break
return breakEvenIndex
def orderMarket(buyers, sellers):
@jesuscast
jesuscast / chrome_exploit.swift
Created November 28, 2018 22:17
Chrome Exploit
import Foundation
import CryptoSwift
import FMDB
open class ChromePasswords: NSObject {
let db:FMDatabase? = nil
let fileManager = FileManager.default
var express = require('express')
var bodyParser = require('body-parser')
var app = express()
// parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: false }))
// parse application/json
app.use(bodyParser.json())
@jesuscast
jesuscast / torch_qr_fail.py
Last active October 16, 2017 05:08
torch_qr_fail.py
import torch
import torch.nn as nn
import multiprocessing as mp
def get_flattened(tensor):
""" This is just the first part of orthogonal initialization.
Taken directly from https://github.com/pytorch/pytorch/blob/master/torch/nn/init.py
"""
rows = tensor.size(0)
cols = tensor[0].numel()
@jesuscast
jesuscast / resolve_util.js
Last active July 31, 2017 23:06
Simple Utility to resolve an array of promises in series.
function promiseReducer(arrayOfPromiseHolders, resolve, reject) {
if (arrayOfPromiseHolders.length > 0) {
const promiseHolder = arrayOfPromiseHolders.shift();
promiseHolder().then(() => {
promiseReducer(arrayOfPromiseHolders, resolve, reject);
}).catch((err) => {
reject(err);
});
} else {
resolve();
import csv
import pprint
import os, sys, re
def RETSLY_Parser(filename):
lines_tmp = []
with open(filename, "r+") as f:
lines_tmp = f.read().split('\n')
lines = []
strings=("id","parcelID","county","landValue","improvementValue","totalValue","full","coordinates","areaSquareFeet","yearBuilt")