Skip to content

Instantly share code, notes, and snippets.

Jordan Baucke jordanbaucke

Block or report user

Report or block jordanbaucke

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View nuts_and_bolts_match.js
let nuts = ['@', '#', '$', '%', '^', '&']
let bolts = ['$', '%', '&', '^', '@', '#']
@jordanbaucke
jordanbaucke / bitfinex-python.py
Created Jun 19, 2013
Python example code for an authenticated call to Bitfinex API v1
View bitfinex-python.py
import requests # pip install requests
import json
import base64
import hashlib
import time #for nonce
api_key = ''
api_secret = ''
#url = 'https://bitfinex.com/api/v1/order/new'
@jordanbaucke
jordanbaucke / testbfx.py
Created Jun 19, 2013
bfx-python-example-run
View testbfx.py
from bitfinex import Bitfinex
import os
with open(os.path.expanduser('~/.bfx_test_account_key.txt'), 'r') as f:
KEY, SECRET = f.read().strip().splitlines()
print (KEY, SECRET)
bfx = Bitfinex()
bfx.key = KEY
bfx.secret = SECRET
@jordanbaucke
jordanbaucke / bitfinex-node.js
Created Jun 19, 2013
NodeJs example code for Bitfinex API v1 Authenticated call
View bitfinex-node.js
var https = require('https');
var crypto = require('crypto');
var url = 'https://bitfinex.com/api/v1/balances';
var subPath = '/balances';
var api_key = '';
var api_secret = '';
var path = '/api/v1' + subPath;
View encryptstring.java
public static String encryptByteArray(byte[] clearData,
PGPPublicKey encKey, boolean withIntegrityCheck, boolean armor)
throws IOException, PGPException, NoSuchProviderException {
ByteArrayOutputStream encOut = new ByteArrayOutputStream();
OutputStream out = encOut;
if (armor) {
out = new ArmoredOutputStream(out);
}
View signmessage.java
private static String signMessageByteArray(String message,
PGPSecretKey pgpSec, char pass[]) throws IOException,
NoSuchAlgorithmException, NoSuchProviderException, PGPException,
SignatureException {
byte[] messageCharArray = message.getBytes();
ByteArrayOutputStream encOut = new ByteArrayOutputStream();
OutputStream out = encOut;
out = new ArmoredOutputStream(out);
View addprovider.java
// add Bouncy JCE Provider, http://bouncycastle.org/latest_releases.html
Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
View addprovider.java
String privateKeyPassword = "hongkong";
PGPPrivateKey pgpPrivKey = pgpSec
.extractPrivateKey(new JcePBESecretKeyDecryptorBuilder()
.setProvider("BC").build(privateKeyPassword.toCharArray()));
View readpublickey.java
public static PGPPublicKey readPublicKey(InputStream input) throws IOException, PGPException {
PGPPublicKeyRingCollection pgpPub = new PGPPublicKeyRingCollection(
PGPUtil.getDecoderStream(input));
Iterator keyRingIter = pgpPub.getKeyRings();
while (keyRingIter.hasNext()) {
PGPPublicKeyRing keyRing = (PGPPublicKeyRing) keyRingIter.next();
Iterator keyIter = keyRing.getPublicKeys();
while (keyIter.hasNext()) {
View readprivatekey.java
public static PGPSecretKey readSecretKey(InputStream input) throws IOException, PGPException {
PGPSecretKeyRingCollection pgpSec = new PGPSecretKeyRingCollection(
PGPUtil.getDecoderStream(input));
Iterator keyRingIter = pgpSec.getKeyRings();
while (keyRingIter.hasNext()) {
PGPSecretKeyRing keyRing = (PGPSecretKeyRing) keyRingIter.next();
Iterator keyIter = keyRing.getSecretKeys();
while (keyIter.hasNext()) {
You can’t perform that action at this time.