Skip to content

Instantly share code, notes, and snippets.

⌨️
keyboard shredding

Miguel Mota miguelmota

⌨️
keyboard shredding
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 / keystore.gql
Last active Jul 17, 2019
GraphQL types for Ethereum keystore
View keystore.gql
type Keystore {
address: String
crypto: KeystoreCrypto
id: String
version: Int
}
type Crypto {
cipher: String
cipherparams: CipherParams
@miguelmota
miguelmota / bcrypt_salt.js
Last active Jul 16, 2019
JavaScript extract salt from bcrypt hash
View bcrypt_salt.js
// the salt is the first 22 characters after the third '$'
// https://en.wikipedia.org/wiki/Bcrypt
const hash = '$2a$10$N9qo8uLOickgx2ZMRZoMyeIjZAgcfl7p92ldGxad68LJZdL17lhWy'
const salt = hash.split('$')[3].substr(0, 22)
console.log(salt) // N9qo8uLOickgx2ZMRZoMye
@miguelmota
miguelmota / keccak_cli.sh
Created Jul 15, 2019
keccak256 cli (macOS)
View keccak_cli.sh
brew install sha3sum
echo -n hello | keccak-256sum
1C8AFF950685C2ED4BC3174F3472287B56D9517B9C948127319A09A7A36DEAC8 -
@miguelmota
miguelmota / transaction_hash.sh
Created Jul 15, 2019
Web3.js get transaction hash from signed transaction data
View transaction_hash.sh
const txHash = web3.utils.sha3('<signed-transaction-data>', {encoding: 'hex'})
@miguelmota
miguelmota / install_deps.sh
Created Jul 14, 2019
TypeScript tslint standard
View install_deps.sh
npm i -D tslint tslint-config-standard
@miguelmota
miguelmota / index.test.ts
Last active Jul 13, 2019
TypeScript tests using jest
View index.test.ts
import * as lib from './'
test('test', async () => {
expect(await lib.hello()).toBe('world')
})
@miguelmota
miguelmota / git-pr-merge
Created Jul 11, 2019
Git (hub) github pull-request merge git extension
View git-pr-merge
#!/bin/bash
# Usage: hub-pr-merge <PR-NUMBER>
#
# Cause a pull request to be merged into its respective base branch.
# If a script errors, force the script to fail immediately.
set -e
ID=$1
@miguelmota
miguelmota / generate_streaming_data.sh
Created Jul 11, 2019
Bash generate streaming data example
View generate_streaming_data.sh
seq 1000 | awk 'BEGIN{OFS="\t"; print "x"}{x=$1/10; print x system("sleep 0.02")}'
@miguelmota
miguelmota / _headers
Last active Jul 12, 2019
Netlify security headers (securityheaders.io)
View _headers
/*
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
Referrer-Policy: no-referrer
X-Content-Type-Options: nosniff
Strict-Transport-Security: max-age=2592000; includeSubDomains; preload
Feature-Policy: geolocation 'none'; midi 'none'; sync-xhr 'none';
microphone 'none'; camera 'none'; magnetometer 'none'; gyroscope 'none';
speaker 'none'; fullscreen 'none'; payment 'none'
Content-Security-Policy: default-src * 'unsafe-inline' 'unsafe-eval'; script-src * 'unsafe-inline' 'unsafe-eval'; connect-src * 'unsafe-inline'; img-src * data: blob: 'unsafe-inline'; frame-src *; style-src * 'unsafe-inline'
@miguelmota
miguelmota / LoadingDots.tsx
Last active Jul 9, 2019
React loading dots component
View LoadingDots.tsx
import React from 'react'
import styled from 'styled-components'
const Dots = styled.div`
display: inline-block;
&::after {
display: inline-block;
animation: ellipsis 1.25s infinite;
content: ".";
You can’t perform that action at this time.