Skip to content

Instantly share code, notes, and snippets.

View BSharp94's full-sized avatar

Brian Sharp BSharp94

  • Forcura
  • Clermont, Fl
View GitHub Profile
@BSharp94
BSharp94 / removeAuth.js
Last active February 6, 2018 21:08
Javascript file to remove authorization from postman collection
function changeAuth(request) {
var newRequest = request;
newRequest.request.auth = { "type": "noauth" };
newRequest.request.header = newRequest.request.header.concat({ "key": "Authorization", "value": "Forcura {{clientIdentifier}}:{{requestSignature}}:{{requestTimestamp}}" })
return request;
}
// recursive method to get to requests
function findRequests(data) {
Verifying my Blockstack ID is secured with the address 19hBLjhiwN5ATrESsAhKAkDrZRe4iM3WAf https://explorer.blockstack.org/address/19hBLjhiwN5ATrESsAhKAkDrZRe4iM3WAf

Keybase proof

I hereby claim:

  • I am bsharp94 on github.
  • I am bsharp94 (https://keybase.io/bsharp94) on keybase.
  • I have a public key ASAoo-b4BD_EfUhOtu8ycLbnzpvT4qlHsBcHtBwPU-dNDwo

To claim this, I am signing this object:

@BSharp94
BSharp94 / filterArrays.js
Created September 6, 2017 12:58
Filter out object intersection in arrays
objInArr(obj, arr){
res = [];
arr.map((a) => {
if (equal(obj, a)){
res.push(true);
}
});
return res.length > 0;
}
let old_ids = [1,2,3];
let new_ids = ['a','b','c'];
let mapping = {};
_.zip(old_ids, new_ids).map(([o,n]) =>
mapping[o.id] = n
);
@BSharp94
BSharp94 / safe_parallel.py
Created June 2, 2017 18:18
Safe kill from Parallel Processes in Python
from multiprocessing import Process, Queue
import sys, time, random
class safe_pool(object):
def __init__(self,num_procs, target):
self.num_procs = num_procs
self.q = Queue()
self.procs_index = [ Process( target=target, args=(self.q,p,)) for p in range(1,num_procs+1)]
@BSharp94
BSharp94 / let_base_recurse.py
Last active June 2, 2017 18:18
Let Base Recurse
def sum_list_recursive(lst):
# let
half = len(lst)/2
first, second = lst[:half],lst[half:]
# base
if len(lst) == 1:
return lst[0]