Skip to content

Instantly share code, notes, and snippets.

View gnidan's full-sized avatar

g. nicholas d'andrea gnidan

View GitHub Profile
@gnidan
gnidan / deployer-example.js
Last active April 6, 2020 02:50
Diamond / Truffle discussion with @mudgen
const Diamond = artifacts.require("Diamond"); // can this return a special Diamond abstraction?
const MyToken = artifacts.require("MyToken");
// - create a config to enable the EIP-2535 Diamond spec
// - when that config is enabled, check for the Diamond EIP-165 functions (so we know when we have a Diamond)
// - add special behavior to the @truffle/contract abstraction when EIP-2535 is detected
module.exports = async (deployer) => {
await deployer.deploy(Diamond);
const diamond = await Diamond.deployed();
@gnidan
gnidan / number-config.ts
Created March 11, 2020 00:23
configurable number formats
// dummy definitions
type BN = { "big-number": number };
type Big = { "big": number; "dot": number };
/*
* high-level: define a type that maps configurable things to allowable option types
*/
// main type (extended from in generics)
type FormatConfig = {
@gnidan
gnidan / testing-framework.plantuml
Last active January 3, 2020 19:03
Eth2 / Truffle Sketching
@startuml
actor User
participant TestingFramework
User -> TestingFramework : begin test
activate TestingFramework
create control EE
TestingFramework -> EE : load EE
Compiling ./contracts/Example.sol...
Compiling ./contracts/Migrations.sol...
Writing artifacts to ./build/contracts
Migrations dry-run (simulation)
===============================
> Network name: 'ropsten-fork'
> Network id: 1337
@gnidan
gnidan / allocation-storage.md
Last active November 18, 2023 02:19
solidity allocation examples

storing things with solidity for fun and confusion

uint64[] with 9 elements

storing [ 10, 11, 12, 13, 14, 15, 16, 17, 18 ]:

   ...
### Keybase proof
I hereby claim:
* I am gnidan on github.
* I am gnidan (https://keybase.io/gnidan) on keybase.
* I have a public key whose fingerprint is 77DB BA82 D20B 39C8 3803 3217 F107 5431 BAD2 5C45
To claim this, I am signing this object:
@gnidan
gnidan / board games
Last active August 29, 2015 14:17
board games
games
=====
lightweight
-----------
- **6 Nimmt**
- **Jungle Speed**
middleweight
@gnidan
gnidan / virus.asm
Created January 6, 2015 16:10
bootloader virus that I wrote for a talk at Drexel
_Text SEGMENT PUBIC USE16
org 0
EntryPoint:
jmp 0x07C0:START
bootMsg db 'Feed me disk sectors, AH AM HUNGRAH',10,13,0
allYourBase db 10,13,'BUUUUURP :-d',10,13,0
om db 'om ', 0
nom db 'nom ', 0
### Keybase proof
I hereby claim:
* I am gnidan on github.
* I am gnidan (https://keybase.io/gnidan) on keybase.
* I have a public key whose fingerprint is 6367 610C 69EB 17CE 8E31 C08E 821C 6650 1D62 1E63
To claim this, I am signing this object:
#!/bin/bash
echoerr() { echo "$@" 1>&2; }
upper() { echo "$@" | tr [a-z] [A-Z]; }
if [ $# -lt 5 ]; then
echoerr "Exports data from mysql database in tables matching a like pattern e.g. 'table_%'"
echoerr "Usage: $0 host dbname dbuser dbpass pattern"
exit 1