Skip to content

Instantly share code, notes, and snippets.

@adidonato
adidonato / rip-dune-data.py
Last active September 16, 2021 16:37
Turn JSON object from Dune gql API into a CSV file
import json
import csv
import sys
def main():
filename = sys.argv[1]
with open(filename) as f:
data = json.load(f)
if data.get("data") is not None:
data = data.get("data")
@adidonato
adidonato / kovan
Created May 24, 2021 17:08
kovan
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
interface Structs {
struct Val {
uint256 value;
}
enum ActionType {
Deposit, // supply tokens
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
<th>inputs</th>
<th>payable</th>
<th>stateMutability</th>
<th>type</th>
<th>anonymous</th>
<th>name</th>
@adidonato
adidonato / osx-status-say.sh
Created April 22, 2020 09:13
Say "Done" or "Failed" when process ends
function status_say () {
echo "EXECUTING: " "$@" "& saying 'done' or 'failed'"
bash -c " $@ && say '$@ is done' || say '$@ has failed' " || echo "Quote the command to be executed status_say `command arg1 arg2`"
}
# add to .bashrc / source
# example: status_say "make install"
#!/usr/bin/sh
command -v docker >/dev/null 2>&1 || { echo >&2 "I require docker but it's not installed. Aborting."; exit 1; }
read -p "
##############################################################
# WARNING! You are about to blow up all your docker stuff #
# By entering Y/y you will remove: #
# - all stopped containers #
# - all networks not used by at least one container #
# - all volumes not used by at least one container #
#!/bin/sh
echo "Usage: ./show_last_updated_hive_table.sh #tablename"
time_column=`hive -e "show create table $1" | egrep "transient_lastDdlTime"`
time_value=`echo $time_column | sed 's/[|,)]//g' | awk -F '=' '{print $2}' | sed "s/'//g"`
tran_date=`date -d @$time_value +'%Y-%m-%d %H:%M:%S'`
echo $tran_date
#!/bin/bash
function post_to_slack () {
# format message as a code block ```${msg}```
SLACK_MESSAGE="\`\`\`$1\`\`\`"
SLACK_URL= # [URL of The Channel you want to post to]
case "$2" in
INFO)
SLACK_ICON=':slack:'
;;
WARNING)
@adidonato
adidonato / split-branch.sh
Created June 18, 2019 11:16
split git branches
git checkout -b <BRANCH-NAME-NEW> start^
for commit in $(git rev-list --reverse <start-sha-commit>..<end-sha-commit>); do
git checkout $commit -- ((LIST OF FILES TO BRANCH OUT))
git commit -C $commit
done(base)
# https://github.com/seebi/tmux-colors-solarized/blob/master/tmuxcolors-256.conf
set-option -g status-bg colour235 #base02
set-option -g status-fg colour136 #yellow
set-option -g status-attr default
# set window split
bind-key v split-window -h
bind-key b split-window
# default window title colors
@adidonato
adidonato / prices
Last active November 16, 2018 14:44
2018-11-15,144.05,144.89,129.83,138.44,208017000.00,1169319667.00
2018-11-14,160.74,162.49,138.04,143.65,153849000.00,1213070013.00
2018-11-13,163.01,164.42,159.37,161.17,155883000.00,1360714704.00
2018-11-12,160.24,167.30,159.89,163.05,198078000.00,1376230076.00
2018-11-11,161.77,162.24,158.42,160.11,317344000.00,1350880369.00
2018-11-10,159.96,163.90,158.69,161.72,320383000.00,1364443572.00
2018-11-09,164.16,165.21,159.58,159.99,210843000.00,1349561475.00
2018-11-08,166.25,174.02,164.29,164.29,139714000.00,1385511418.00
2018-11-07,170.12,171.32,164.27,166.45,190695000.00,1403421907.00
2018-11-06,164.86,172.42,163.99,170.47,167367000.00,1428094259.00