Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
⚡️

Alexander alexanderattar

💭
⚡️
View GitHub Profile
@alexanderattar
alexanderattar / json-parsing.go
Created Feb 20, 2020 — forked from tomnomnom/json-parsing.go
Parsing arbitrary JSON with go
View json-parsing.go
package main
import (
"log"
"fmt"
"encoding/json"
)
func main() {
b := []byte(`{"name": "tom", "favNum": 6, "interests": ["knives", "computers"], "usernames": {"github": "TomNomNom", "twitter": "@TomNomNom"}}`)
@alexanderattar
alexanderattar / redis_cheatsheet.bash
Created Aug 27, 2019 — forked from LeCoupa/redis_cheatsheet.bash
Redis Cheatsheet - Basic Commands You Must Know --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
View redis_cheatsheet.bash
# Redis Cheatsheet
# All the commands you need to know
redis-server /path/redis.conf # start redis with the related configuration file
redis-cli # opens a redis prompt
# Strings.
@alexanderattar
alexanderattar / signTypedData.js.md
Last active Jul 22, 2019 — forked from backus/signTypedData.js.md
How signTypedData works
View signTypedData.js.md

I couldn't find a good explanation of each step of signTypedData EIP with examples of inputs and outputs at each step. I wanted this so I could keep track.

Say this is our private key

const privKey = new Buffer(
  "c87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3",
  "hex"
);
View deploy_solidity_contract.js
let fs = require("fs");
let Web3 = require('web3'); // https://www.npmjs.com/package/web3
// Create a web3 connection to a running geth node over JSON-RPC running at
// http://localhost:8545
// For geth VPS server + SSH tunneling see
// https://gist.github.com/miohtama/ce612b35415e74268ff243af645048f4
let web3 = new Web3();
web3.setProvider(new web3.providers.HttpProvider('http://localhost:8545'));
@alexanderattar
alexanderattar / postgres_array.go
Created Jul 17, 2018 — forked from adharris/postgres_array.go
PostgreSQL demo of Array types using Golang
View postgres_array.go
package main
import (
"database/sql"
"errors"
"fmt"
_ "github.com/bmizerany/pq"
"os"
"regexp"
"strings"
View ethereum-yellow-paper-symbols.md

Univerally recognised mathematical symbols and their name/meaning

≡ is defined as/is equivalent to

= is equal to

≠ is not equal to

‖...‖ size (length) of

@alexanderattar
alexanderattar / verify-eth-sig.js
Last active Sep 20, 2020
Example of how to sign a message with web3 and recover the address that signed it
View verify-eth-sig.js
var ethUtil = require('ethereumjs-util');
var data = 'Login';
var message = ethUtil.toBuffer(data);
var msgHash = ethUtil.hashPersonalMessage(message);
var privateKey = new Buffer('62debf78d596673bce224a85a90da5aecf6e781d9aadcaedd4f65586cfe670d2', "hex")
var sig = ethUtil.ecsign(msgHash, privateKey);
var signature = ethUtil.toBuffer(sig)
@alexanderattar
alexanderattar / verify_eth_sig.go
Last active Feb 16, 2018
Example of verifying a ethereum signature from a signed message in Go. Returns the signers address.
View verify_eth_sig.go
package main
import (
"fmt"
"github.com/ethereum/go-ethereum/crypto"
"github.com/go-ethereum/common/hexutil"
)
func main() {
@alexanderattar
alexanderattar / update-golang.md
Last active Feb 16, 2018 — forked from nikhita/update-golang.md
How to update the Go version
View update-golang.md

How to update the Go version

System: Mac OS Sierra (10.12.6)

1. Uninstall the exisiting version

As mentioned here, to update a go version you will first need to uninstall the original version.

To uninstall, delete the /usr/local/go directory by:

View keybase.md

Keybase proof

I hereby claim:

  • I am alexanderattar on github.
  • I am spheres (https://keybase.io/spheres) on keybase.
  • I have a public key whose fingerprint is 4DA1 8F55 B579 3278 F11A 3674 7711 0903 C05C 6ECF

To claim this, I am signing this object:

You can’t perform that action at this time.