Skip to content

Instantly share code, notes, and snippets.

View alexanderattar's full-sized avatar
💭
⚡️

Alexander alexanderattar

💭
⚡️
View GitHub Profile
@alexanderattar
alexanderattar / postgres_array.go
Created July 17, 2018 14:17 — forked from adharris/postgres_array.go
PostgreSQL demo of Array types using Golang
package main
import (
"database/sql"
"errors"
"fmt"
_ "github.com/bmizerany/pq"
"os"
"regexp"
"strings"

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 October 4, 2023 15:11
Example of how to sign a message with web3 and recover the address that signed it
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 February 16, 2018 22:20
Example of verifying a ethereum signature from a signed message in Go. Returns the signers address.
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 February 16, 2018 21:34 — forked from nikhita/update-golang.md
How to update the Go version

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:

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:

// Report on "stuck" ether in empty contracts
// https://github.com/ethereum/EIPs/issues/156
// Usage: node find-stuck-ether.js [startBlock] [endBlock] > report.txt
let Eth = require('ethjs');
let eth = new Eth(new Eth.HttpProvider('http://localhost:8545'));
let ethutil = require('ethereumjs-util')
async function main() {
layout title description tags
default
SQL Style Guide
A guide to writing clean, clear, and consistent SQL.
data
process

Purpose

@alexanderattar
alexanderattar / PostgreSQL_index_naming.rst
Created September 11, 2017 21:04 — forked from popravich/PostgreSQL_index_naming.rst
PostgreSQL index naming convention to remember

The standard names for indexes in PostgreSQL are:

{tablename}_{columnname(s)}_{suffix}

where the suffix is one of the following:

  • pkey for a Primary Key constraint;
  • key for a Unique constraint;
  • excl for an Exclusion constraint;
  • idx for any other kind of index;
@alexanderattar
alexanderattar / .Title
Created August 17, 2017 03:40 — forked from congjf/.Title
Using MongoDB in golang with mgo
Using MongoDB in golang with mgo