Skip to content

Instantly share code, notes, and snippets.

Avatar
🌎
wfh

Robert Durst robertDurst

🌎
wfh
View GitHub Profile
@robertDurst
robertDurst / comparison.py
Last active Nov 3, 2019
Bubble Sort vs. Comb Sort
View comparison.py
import random
import cProfile
def swap(arr, a, b):
arr[a], arr[b] = arr[b], arr[a]
def getNextGap(gap):
gap = (gap * 10) / 13
if gap < 1:
return 1
View hashmap.js
// started 8:00 - 8:45/9:00 (while chatting w/ friends)
const START_SIZE = 10;
const BUCKET_LIMIT = 3;
class HashMap {
constructor() {
this.values = new Array(START_SIZE);
this.count = START_SIZE;
this.length = START_SIZE;
@robertDurst
robertDurst / Tree.py
Created Sep 28, 2019
Traversal Practice
View Tree.py
class Tree:
def __init__(self, value):
self.value = value
self.left = None
self.right = None
def inorder(node):
# fill in code
return
@robertDurst
robertDurst / NERDTree.mkd
Created Aug 15, 2019 — forked from m3nd3s/NERDTree.mkd
My Vim Cheat Sheet
View NERDTree.mkd

NERDTree

o.......Open files, directories and bookmarks....................|NERDTree-o|
go......Open selected file, but leave cursor in the NERDTree.....|NERDTree-go|
t.......Open selected node/bookmark in a new tab.................|NERDTree-t|
T.......Same as 't' but keep the focus on the current tab........|NERDTree-T|
i.......Open selected file in a split window.....................|NERDTree-i|
gi......Same as i, but leave the cursor on the NERDTree..........|NERDTree-gi|
s.......Open selected file in a new vsplit.......................|NERDTree-s|
gs......Same as s, but leave the cursor on the NERDTree..........|NERDTree-gs|
O.......Recursively open the selected directory..................|NERDTree-O|
@robertDurst
robertDurst / code.js
Created Jul 31, 2018
Code for calculating inflation for an account since a given time.
View code.js
var StellarSdk = require('stellar-sdk');
var server = new StellarSdk.Server('https://horizon.stellar.org');
// Make sure date is in # of seconds since unix epoch
async function getInflationForAccountSinceDate(account, time) {
const resp = await server.transactions()
.forAccount(account)
.limit(200)
.order("desc")
.call();
@robertDurst
robertDurst / ShamirSecretShare.rs
Created Jul 20, 2018
LaGrange interpolation implementation in rust demonstrating how to calculate f(0) for a given set of points.
View ShamirSecretShare.rs
// Because of this feature gate, you must use a nightly
// version of rust.
#![feature(euclidean_division)]
#[derive(Debug)]
struct Point {
x: f64,
y: f64,
}
View keybase.md

Keybase proof

I hereby claim:

  • I am robertdurst on github.
  • I am r_durst (https://keybase.io/r_durst) on keybase.
  • I have a public key ASAQplJiEBCTbetcNR-jo6yHH3FHZBH8ElqheC4N4gGo0wo

To claim this, I am signing this object:

@robertDurst
robertDurst / SEP007.md
Last active May 29, 2018
Proposed SEP007 approaches for dealing with empty/null public key.
View SEP007.md

SEP007 Stellar-JS-SDK Integration

Background

As part of the protocol outlined in SEP007, to create a uri without a known source account beforehand, you must specify the source account in the XDR as all zeros.

xdr (required) - A Stellar transaction in XDR format that is base64 encoded and then URL-encoded. If the source account in the xdr is all zeros then the URI handler should replace the source account and sequence number with the user's source account and sequence number before it signs it. If the source account is set and the sequence number is 0 then the URI handler should replace only the sequence number before signing.

Currently this is not possible in the Stellar-JS-SDK.

Overview