Skip to content

Instantly share code, notes, and snippets.

@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.

@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 / 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 / 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
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 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"
@davidp94
davidp94 / borromean.py
Created February 8, 2019 09:18 — forked from badmofo/borromean.py
Pure Python Borromean Ring Signatures
'''
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
@davidp94
davidp94 / gist:e32bd9f51a6cc34ba303713cb557b358
Created October 3, 2018 19:59
remove untagged images docker
docker rmi $(docker images -a | grep "^<none>" | awk '{print $3}')
@davidp94
davidp94 / metamask_signing_form.html
Created August 14, 2018 15:55
Metamask signing form
<!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 August 14, 2018 14:20
Call Metamask to sign random data from web developers console
web3.eth.sign(web3.toChecksumAddress(web3.eth.accounts[0]), web3.sha3("hello this is a message to be signed"), console.log)