Skip to content

Instantly share code, notes, and snippets.

David Phan davidp94

View GitHub Profile
@davidp94
davidp94 / getXML.go
Created Oct 23, 2019 — forked from james2doyle/getXML.go
Use HTTP to GET and parse XML in golang
View getXML.go
// tweaked from: https://stackoverflow.com/a/42718113/1170664
func getXML(url string) ([]byte, error) {
resp, err := http.Get(url)
if err != nil {
return []byte{}, fmt.Errorf("GET error: %v", err)
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return []byte{}, fmt.Errorf("Status error: %v", resp.StatusCode)
@davidp94
davidp94 / 99-install-facetime-camera.sh
Created Jul 14, 2019 — forked from Stono/99-install-facetime-camera.sh
Install the kernal module required for the facetimehd camera to work on Linux
View 99-install-facetime-camera.sh
#!/bin/bash
set -e
export CONFIG_MODULE_SIG=n
export CONFIG_MODULE_SIG_ALL=n
export KERNELRELEASE=${1}
echo "Installing FacetimeHD camera for $KERNELRELEASE"
cd /tmp
git clone https://github.com/patjak/bcwc_pcie.git
View ZoKrates non-Repudiable Identity-Linked Proofs of Knowledge
import "ecc/babyjubjubParams.code" as context
import "ecc/proofOfOwnership.code" as proofOfOwnership
import "hashes/sha256/512bitPacked.code" as sha256packed
def proofOfKnowledge(private field[4] secret, field[2] hash) -> (field):
// check that the computed hash matches the input
hash == sha256packed(secret)
return 1
def main(field[2] pkA, field[2] pkB, field[2] hash, private field skA, private field[4] secret, private field skB) -> (field):
@davidp94
davidp94 / Cargo.toml
Created Mar 20, 2019 — forked from Vinc0682/Cargo.toml
rust-sgx local attestation made easy
View Cargo.toml
[dependencies]
sgx-isa = { version = "0.2", features = ["sgxstd"] }
# RustCrypto, used for CMAC
cmac = "0.2.0"
crypto-mac = "0.7.0"
aes = "0.3.2"
block-cipher-trait = "0.6.2"
generic-array = "0.12"
@davidp94
davidp94 / borromean.py
Created Feb 8, 2019 — forked from badmofo/borromean.py
Pure Python Borromean Ring Signatures
View borromean.py
'''
Pure Python Borromean Ring Signatures
DEPENDS ON: pip install ecdsa
WARNING: THIS IS A PEDAGOGICAL IMPLEMENTATION.
PERFORMANCE IS HORRIBLE AND NON-CONSTANT.
CORNER CASES ARE NOT PROPERLY CHECKED.
FOR THE LOVE OF GOD USE THE CODE FROM THE ELEMENTS PROJECT.
https://gist.github.com/badmofo/2d6e66630e4a6748edb7
'''
from hashlib import sha256
View gist:e32bd9f51a6cc34ba303713cb557b358
docker rmi $(docker images -a | grep "^<none>" | awk '{print $3}')
View metamask_signing_form.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<!--
Created using JS Bin
http://jsbin.com
Copyright (c) 2018 by anonymous (http://jsbin.com/fovamotoca/2/edit)
@davidp94
davidp94 / metamask_js_call_console_sign.js
Created Aug 14, 2018
Call Metamask to sign random data from web developers console
View metamask_js_call_console_sign.js
web3.eth.sign(web3.toChecksumAddress(web3.eth.accounts[0]), web3.sha3("hello this is a message to be signed"), console.log)
@davidp94
davidp94 / check_permissions_s3.py
Created Jul 6, 2018
Check read only and read-write permissions on S3 bucket
View check_permissions_s3.py
import boto3, botocore
BUCKET_NAME = ''
READ_ONLY_ID = ''
READ_ONLY_KEY = ''
RW_ID = ''
RW_KEY = ''
# List objects in an Amazon S3 bucket
# http://boto3.readthedocs.io/en/latest/reference/services/s3.html#id209
View NodeJS v8 One Liner Install Ubuntu 16.04
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
You can’t perform that action at this time.