Skip to content

Instantly share code, notes, and snippets.

@deweller
deweller / env.helper.php
Last active January 20, 2023 14:06 — forked from mattstauffer/env.helper.php
Laravel's env() helper
<?php
/**
* Gets the value of an environment variable. Supports boolean, empty and null.
*
* @param string $key
* @param mixed $default
* @return mixed
*/
function env($key, $default = null)
@deweller
deweller / crypto-aes-gcm.js
Last active February 16, 2022 08:56 — forked from chrisveness/crypto-aes-gcm.js
Uses the SubtleCrypto interface of the Web Cryptography API to encrypt and decrypt text using AES-GCM (AES Galois counter mode).
/**
* Encrypts plaintext using AES-GCM with supplied password, for decryption with aesGcmDecrypt().
* (c) Chris Veness MIT Licence
*
* @param {String} plaintext - Plaintext to be encrypted.
* @param {String} password - Password to use to encrypt plaintext.
* @returns {String} Encrypted ciphertext.
*
* @example
* const ciphertext = await aesGcmEncrypt('my secret text', 'pw');
@deweller
deweller / test_bitcoind.py
Last active August 29, 2015 14:24 — forked from robby-d/test_bitcoind.py
Test bitcoind searchrawtransactions. Suitable for logging. Use python3 -u test_bitcoind.py > timing.csv
#!/usr/bin/env python3
import requests, json
import time
rpcPort = 8332
rpcUser = 'rpc'
rpcPassword = 'YOUR PASSWORD HERE'
serverURL = 'http://' + rpcUser + ':' + rpcPassword + '@localhost:' + str(rpcPort)
print ("Timestamp,Milliseconds")