Skip to content

Instantly share code, notes, and snippets.

@bendecoste
bendecoste / main.rs
Created September 21, 2021 14:51
calculates a pearson correlation across a dataset in rust using arrow
,a,b,c,d,e
0,0.6814611110243137,0.6717864214363795,0.022958332920425484,0.08478621772737338,0.04961595963284171
1,0.38991987410479356,0.8903937734750442,0.2960388452175704,0.3363509070949091,0.20337348576736802
2,0.7574938133161713,0.7897885504316133,0.03170309286978368,0.47982369001503866,0.7332330994006948
3,0.02070336985072052,0.4074216726445976,0.2162916568048835,0.15929467528039443,0.022673636152528598
4,0.6137317553158015,0.040453230362753834,0.5154285784022256,0.2688169059454769,0.9156391543958896
5,0.27660279313294867,0.21234988520610365,0.18765627458944767,0.518836768635314,0.3349548716806814
6,0.36475753475762396,0.48691866221177327,0.9732558462702392,0.7506046373746301,0.09004911112073366
7,0.3457708550872354,0.7738168619612238,0.9828833632744532,0.7425718451141586,0.3651191802668795
8,0.1369403460477896,0.26012448772760566,0.48631837085782403,0.8219742274452283,0.8697398369897079
@bendecoste
bendecoste / roles.txt
Created July 30, 2020 20:03
roles in cape
## In cape there are two contexts you can be operating in
## 1. Global commands, these are things that affect how cape functions in your entire organization
## For example, creating a user
## 2. Project commands, these are things that only affect the specific project you are operating on
## For example, setting a policy on a project
##
## Within each of these spaces, there are different roles that you can have
##
## Globally, you can either be an `admin`, or a `user`. Admins can do anything in the system, it is much like
## being a superuser on a traditional linux system. `user` has much less access, they can read various details
@bendecoste
bendecoste / policy.txt
Created July 30, 2020 19:00
cape policy examples
## Overview of the policy commands
./bin/cape projects policy
NAME:
cape projects policy - Commands for interacting with Cape Project Policy.
USAGE:
cape projects policy command [command options] [arguments...]
DESCRIPTION:
Commands for interacting with Cape Project Policy.
package main
import "fmt"
type Permission uint64
const (
WritePolicy Permission = 1 << iota
WritePolicySpec
ArchiveProject
UnarchiveProject
UpdateProjectName
UpdateProjectDescription
@bendecoste
bendecoste / securenn.py
Created November 19, 2018 18:55
how to use securenn protocol in tfe
import tf_encrypted as tfe
# change to secureNN!
tfe.set_protocol(tfe.protocol.SecureNN())
# alice does this on her machine
alice_secret = np.array([1,2,3])
alice_0, alice_1 = encode(alice_secret)
# bob does this on his machine
bob_secret = np.array([4,5,6])
bob_0, bob_1 = encode(bob_secret)
# alice then sends alice_1 to bob and bob sends bob_0 to alice.
@bendecoste
bendecoste / mpc_share.py
Last active November 6, 2018 13:54
MPC encode function
def share(secret):
# share_0 will become some random number
share_0 = random.uniform(secret.shape)
# create share_1 by subtracting the secret from the random number
# this means we can recreate the secret by adding the two shares together
share_1 = secret - share_0
return share_0, share_1
# example usage
@bendecoste
bendecoste / private_compare.py
Created September 5, 2018 13:38
SecureNN private compare
import numpy as np
import random
p = 67
bits = 64
def sample_random_tensor(shape, modulus=p):
if len(shape) >= 1:
n = np.prod(shape)
else:
### Keybase proof
I hereby claim:
* I am bendecoste on github.
* I am neb (https://keybase.io/neb) on keybase.
* I have a public key whose fingerprint is 593C D5B3 60AD 0AC8 7A4C 1572 1EE4 8BA8 B17F EA8D
To claim this, I am signing this object:
@bendecoste
bendecoste / page.html
Created May 6, 2014 13:01
goinstant webRTC example
x.html
<html><head>
<script src="https://cdn.goinstant.net/v1/platform.min.js"></script><style type="text/css"></style>
<script type="text/javascript" src="https://cdn.goinstant.net/widgets/webrtc/latest/webrtc.min.js"></script>
<!-- CSS is optional -->
<link rel="stylesheet" href="https://cdn.goinstant.net/widgets/webrtc/latest/webrtc.css">
<script src="script.js"></script>
</head>
<body onload="onLoad();">