Skip to content

Instantly share code, notes, and snippets.

⌨️
keyboard shredding

Miguel Mota miguelmota

Block or report user

Report or block miguelmota

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@miguelmota
miguelmota / read_dir.go
Created May 22, 2019
Golang read list of files in directory
View read_dir.go
package main
import (
"fmt"
"io/ioutil"
"log"
)
func main() {
files, err := ioutil.ReadDir("./static/")
@miguelmota
miguelmota / graphql_query.js
Created May 18, 2019
Node GraphQL query example using fetch
View graphql_query.js
const fetch = require('node-fetch')
const query = `
query Echo($message:String) {
message: echo(message:$message)
}
`
const variables = {
message: 'hello'
@miguelmota
miguelmota / copy_object_properties.go
Created May 17, 2019
Golang copy map object properties to another map object (js destructing equivalent)
View copy_object_properties.go
package main
import "fmt"
func main() {
person := map[string]interface{}{
"name": "test",
"age": 13,
"school": "stanford",
}
View gist:00749504c2b2d1706958b53c2db6cf19
Verifying my identity on Peepeth.com 0x4cca5f2f01746b1c13ca7a3dab0462d225795d3a
@miguelmota
miguelmota / chart_points.go
Created May 13, 2019
Golang termui get chart points
View chart_points.go
package main
import (
"fmt"
"math"
ui "github.com/gizak/termui/v3"
"github.com/gizak/termui/v3/widgets"
)
@miguelmota
miguelmota / regex_replace.go
Last active May 12, 2019
Golang replace string using regular expression (regex)
View regex_replace.go
package main
import (
"fmt"
"regexp"
"strings"
)
func main() {
re := regexp.MustCompile(`[^a-zA-Z0-9]`)
@miguelmota
miguelmota / ami_install_build_tools.sh
Created May 10, 2019
AWS Linux AMI install g++ (gcc) and essential build tools
View ami_install_build_tools.sh
yum groupinstall 'Development Tools'
@miguelmota
miguelmota / prefix_message.js
Created May 10, 2019
Truffle web3.js add prefix to message hash for signing example
View prefix_message.js
let hash = web3.utils.soliditySha3('abc')
let prefixedHash = web3.utils.soliditySha3('\x19Ethereum Signed Message:\n32', hash)
View web3_send_eth.js
await web3.eth.sendTransaction({
from: alice,
to: bob,
value: '0x1' // 1 wei
})
You can’t perform that action at this time.