Skip to content

Instantly share code, notes, and snippets.

View alangrainger's full-sized avatar

Alan Grainger alangrainger

View GitHub Profile
@alangrainger
alangrainger / keybase.md
Last active September 7, 2019 08:03
keybase.md

Keybase proof

I hereby claim:

  • I am alangrainger on github.
  • I am alan_ (https://keybase.io/alan_) on keybase.
  • I have a public key ASCAG1R7ChZGELoMqd3l_rSOtAosrnIYgvSnFh2xbMC4awo

To claim this, I am signing this object:

@alangrainger
alangrainger / okex.php
Created May 8, 2019 09:58
Signed OKEX requests with CURL and PHP
$time = round(microtime(true), 3);
$method = strtoupper($method);
$string = $time . $method . $endpoint;
$hash = hash_hmac('sha256', $string, $secret);
$hash = base64_encode(hex2bin($hash));
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://www.okex.com' . $endpoint,
@alangrainger
alangrainger / decrypt.php
Created October 30, 2017 06:20
PHP hosted encrypted text drop box
<?php
/*
Command lines to generate the keys:
openssl genpkey -algorithm RSA -out private_key.pem -pkeyopt rsa_keygen_bits:2048
openssl rsa -pubout -in private_key.pem -out public_key.pem
*/
if (isset($_POST['data'])) {