Skip to content

Instantly share code, notes, and snippets.

@davidp94
davidp94 / Cargo.toml
Created March 20, 2019 18:48 — forked from Vinc0682/Cargo.toml
rust-sgx local attestation made easy
[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"
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 / 99-install-facetime-camera.sh
Created July 14, 2019 23:29 — forked from Stono/99-install-facetime-camera.sh
Install the kernal module required for the facetimehd camera to work on Linux
#!/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
@davidp94
davidp94 / getXML.go
Created October 23, 2019 04:28 — forked from james2doyle/getXML.go
Use HTTP to GET and parse XML in golang
// 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 / main.py
Created May 22, 2021 09:13
python account identifier from Principal Id
import hashlib
import base64
import math
import binascii
if __name__ == '__main__':
principal_id_str = "m7b5y-itxyr-mr2gt-kvadr-2dity-bh3n5-ff7bb-vvm2v-3ftew-5wjtg-2qe"
subaccount = bytearray(32)
# principal_id_str = "kb4lg-bqaaa-aaaab-qabfq-cai"
@davidp94
davidp94 / gnosis_safe_xdefi_to_ctrl.md
Created October 20, 2024 13:06
Guide to migration XDEFI to CTRL for Gnosis Safe

Guide for XDEFI to CTRL Migration for Gnosis Safe User

This guide outlines two methods for migrating your XDEFI tokens to CTRL:

  1. Method 1: Using a Gnosis Safe or other multi-signature wallet for a manual batch transaction.
  2. Method 2: An easier alternative that involves sending tokens to a personal wallet and using the migration app.