Skip to content

Instantly share code, notes, and snippets.

View jaybuidl's full-sized avatar
📐

jaybuidl jaybuidl

📐
View GitHub Profile
@jaybuidl
jaybuidl / signature-fun.sh
Last active June 19, 2023 16:20
Once Foundry is installed, the script uses cast to generate a burner wallet stored in an unencrypted keystore file under ./test-keystore/, then it signs and verifies a "hello world!" message.
#!/usr/bin/env bash
# cast is required: https://book.getfoundry.sh/getting-started/installation
[ ! -x "$(command -v cast)" ] && echo "cast is not installed, please run 'curl -L https://foundry.paradigm.xyz | bash'." && exit 1
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
ETH_KEYSTORE_DIR=$SCRIPT_DIR/test-keystore
if [ ! -d "$ETH_KEYSTORE_DIR" ]; then
echo "Creating test keystore"
@jaybuidl
jaybuidl / create-volume-group.sh
Last active June 18, 2023 17:10
APFS volume group creation
# Lookup your existing disks and volumes
diskutil apfs list
# We will modify diskX
disk=diskX
# Assuming that the volume diskXs1 already exist, we need to mark it as a data volume before adding it to a group.
diskutil apfs chrole ${disk}s1 D
# The volume group cannot be created directly. It will be created during the creation of the 2nd volume.
@jaybuidl
jaybuidl / curate-get.sh
Last active April 29, 2022 17:26
Get information about an Ethereum contract address from Kleros Curate
#!/bin/bash
if [[ ! "$1" ]]
then
echo "Usage: $(basename $0) [address]"
exit 1
fi
address=$1
@jaybuidl
jaybuidl / get-prices.sh
Last active February 6, 2022 17:25
Live prices download from Alpha Vantage
#!/bin/bash
# precondition: jq installed
pkg="jq"
if [[ $(dpkg-query -W -f='${Status}' $pkg 2>/dev/null) != "install ok installed" ]];
then
echo "$pkg package not found: installing"
if sudo apt-get install -y $pkg;
then
echo "$pkg installation successful, continuing...";
@jaybuidl
jaybuidl / settings.json
Created January 11, 2022 18:09
VS Code settings allowing the integrated terminal to use an upgraded bash installed from brew
{
"terminal.integrated.profiles.osx": {
"Bash (from brew)": {
"path": "/usr/local/bin/bash",
"args": ["-l"]
}
},
"terminal.integrated.defaultProfile.osx": "Bash (from brew)"
}
import { ethers } from "hardhat";
async function main() {
let abi = `[{"constant":false,"inputs":[{"name":"_pinakion","type":"address"}],"name":"changePinakion","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"RNBlock","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"disputesWithoutJurors","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"passPhase","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"governor","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"lastDelayedSetStake","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_d
@jaybuidl
jaybuidl / list-kleros-dependants.sh
Last active December 14, 2021 15:16
Shows the dependencies between Kleros NPM packages
#!/bin/bash
npm list -g npm-dependants || npm install -g npm-dependants
for p in $(npm search @kleros --parseable | cut -f1 | sort)
do
echo $p
npm-dependants $p | sed 's/^/├─ /g'
echo
done
@jaybuidl
jaybuidl / mermaid-plugin.webpack.js
Created October 7, 2021 12:40
drawio_mermaid_plugin
This file has been truncated, but you can view the full file.
/*! For license information please see mermaid-plugin.webpack.js.LICENSE.txt */
(()=>{var t={9609:t=>{"use strict";var e=/^(%20|\s)*(javascript|data)/im,n=/[^\x20-\x7E]/gim,r=/^([^:]+):/gm,i=[".","/"];t.exports={sanitizeUrl:function(t){if(!t)return"about:blank";var a,o,s=t.replace(n,"").trim();return function(t){return i.indexOf(t[0])>-1}(s)?s:(o=s.match(r))?(a=o[0],e.test(a)?"about:blank":s):"about:blank"}}},4949:(t,e,n)=>{t.exports={graphlib:n(6614),dagre:n(6478),intersect:n(8114),render:n(5787),util:n(8355),version:n(5689)}},9144:(t,e,n)=>{var r=n(8355);function i(t,e,n,i){var a=t.append("marker").attr("id",e).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerUnits","strokeWidth").attr("markerWidth",8).attr("markerHeight",6).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").style("stroke-width",1).style("stroke-dasharray","1,0");r.applyStyle(a,n[i+"Style"]),n[i+"Class"]&&a.attr("class",n[i+"Class"])}t.exports={default:i,normal:i,vee:function(t,e,n,i){var a=t.append(
@jaybuidl
jaybuidl / autossh.service
Created February 18, 2020 08:13 — forked from thomasfr/autossh.service
Systemd service for autossh
[Unit]
Description=Keeps a tunnel to 'remote.example.com' open
After=network.target
[Service]
User=autossh
# -p [PORT]
# -l [user]
# -M 0 --> no monitoring
# -N Just open the connection and do nothing (not interactive)
@jaybuidl
jaybuidl / scp-docker-data-volumes.sh
Created January 10, 2017 10:37
Copies all the local docker data volumes to a new machine via ssh
#/!bin/bash
[ $# -lt 1 ] && echo "usage: $(basename $0) <target_ssh_user@target_ssh_hostname>" && exit 1;
target="$1"
docker pull alpine
for volume in $(docker volume ls -q)
do