Community
Cheatsheets
- GenServer Cheatsheet by Benjamin Tan Wei Hao
Books
Community
Cheatsheets
Books
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' |
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): |
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()) |
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() |
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") |