Skip to content

Instantly share code, notes, and snippets.

@miguelmota
miguelmota / ethers_ledger_signer.js
Last active March 24, 2023 08:45
Ethers.js Ledger Signer example
const { providers } = require('ethers')
const { LedgerSigner } = require('@ethersproject/hardware-wallets')
const provider = new providers.JsonRpcProvider('https://mainnet.infura.io')
const type = 'hid'
const path = `m/44'/60'/0'/0/0`
const signer = new LedgerSigner(provider, type, path)
const address = await signer.getAddress()
console.log(address)
@samoshkin
samoshkin / env.sh
Created April 18, 2019 22:36
fzf configuration snippet
# Exclude those directories even if not listed in .gitignore, or if .gitignore is missing
FD_OPTIONS="--follow --exclude .git --exclude node_modules"
# Change behavior of fzf dialogue
export FZF_DEFAULT_OPTS="--no-mouse --height 50% -1 --reverse --multi --inline-info --preview='[[ \$(file --mime {}) =~ binary ]] && echo {} is a binary file || (bat --style=numbers --color=always {} || cat {}) 2> /dev/null | head -300' --preview-window='right:hidden:wrap' --bind='f3:execute(bat --style=numbers {} || less -f {}),f2:toggle-preview,ctrl-d:half-page-down,ctrl-u:half-page-up,ctrl-a:select-all+accept,ctrl-y:execute-silent(echo {+} | pbcopy)'"
# Change find backend
# Use 'git ls-files' when inside GIT repo, or fd otherwise
export FZF_DEFAULT_COMMAND="git ls-files --cached --others --exclude-standard | fd --type f --type l $FD_OPTIONS"
@robballou
robballou / commit_everything.sh
Last active December 14, 2022 21:23
A script to commit the git parent repo and any submodule changes too
#!/bin/bash
#
# Usage: ./commit_everything.sh "Commit message"
BOLD=$(tput bold)
BLACK=$(tput setaf 0)
WHITE=$(tput setaf 7)
BLUE=$(tput setaf 4)
GREEN=$(tput setaf 2)
NORMAL=$(tput sgr0)
@suwhs
suwhs / gradle.md
Last active January 4, 2021 22:17
5 steps for bintray-upload build.gradle (for jcenter)

add bintray and maven plugin to buildscript dependencies (project's build.gradle)

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.1.2'
 classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2' // ADD THIS LINE
@sambauers
sambauers / .profile-emoji-me.sh
Last active November 19, 2021 15:59
Adds random emoji to your terminal prompt on Mac OS X, because emoji.
# Add this file to your home directory then include it in ~/.profile using `. ~/.profile-emoji-me.sh`
# These will show up in an emoji compatible terminal
ME_EMOJI=(🐶 🐱 🐭 🐹 🐰 🦊 🐻 🐼 🐨 🐯 🦁 🐮 🐷 🐸 🐵 🐙);
RANDOM_ME_EMOJI=${ME_EMOJI[$((RANDOM%14))]};
export PS1="\h:\W \u $RANDOM_ME_EMOJI ";
export PROMPT_COMMAND='update_terminal_cwd; echo -ne "\033]0;${RANDOM_ME_EMOJI##*/}\007"';
@rietta
rietta / random_hash.sh
Created September 5, 2012 17:01
Easy command line random hash generator for Mac OS X, Linux, and FreeBSD.
#!/bin/sh
head -n 4096 /dev/urandom | openssl sha1