Skip to content

Instantly share code, notes, and snippets.

View tianhaoz95's full-sized avatar

Tianhao Zhou tianhaoz95

View GitHub Profile
sudo systemctl start duino
sudo systemctl enable duino
sudo apt install python3 python3-pip git
git clone https://github.com/revoxhere/duino-coin
cd duino-coin && python3 PC_Miner.py
# /etc/systemd/system/duino.service
[Unit]
Description=duino
ConditionPathExists=/home/pi/Crypto/duino-coin/PC_Miner.py
After=network.target
[Service]
Type=simple
WorkingDirectory=/home/pi/Crypto/duino-coin/
ExecStart=/usr/bin/python3 PC_Miner.py
#!/bin/sh
TOTAL_HEIGHT=$(curl -s https://rpc-cronos.crypto.org/commit | jq -r ".result.signed_header.header.height")
CURRENT_HEIGHT=$(cronosd status 2>&1 --home $CRONOS_HOME | jq -r '.SyncInfo.latest_block_height')
PROGRESS=$(echo "scale=2; $CURRENT_HEIGHT/$TOTAL_HEIGHT*100" | bc -l)
MSG="Progress $CURRENT_HEIGHT / $TOTAL_HEIGHT ($PROGRESS%)"
@tianhaoz95
tianhaoz95 / check_progress.sh
Created December 27, 2021 08:26
A short script to check the sync progress of Cronos node :)
#!/bin/sh
TOTAL_HEIGHT=$(curl -s https://rpc-cronos.crypto.org/commit | jq -r ".result.signed_header.header.height")
CURRENT_HEIGHT=$(cronosd status 2>&1 --home $CRONOS_HOME | jq -r '.SyncInfo.latest_block_height')
PROGRESS=$(echo "scale=2; $CURRENT_HEIGHT/$TOTAL_HEIGHT*100" | bc -l)
echo "Progress $CURRENT_HEIGHT / $TOTAL_HEIGHT ($PROGRESS%)"
import streamlit as st
import pandas as pd
crypto_wallet_history = upload_csv('Crypto)
fiat_wallet_history = upload_csv('Fiat')
visa_card_history = upload_csv('Visa')
features = fetch_feature_flags()
combined_history = pd.concat([crypto_wallet_history, fiat_wallet_history, visa_card_history])
if not combined_history.empty:
if 'raw_table' in features:
st.subheader('Raw Table')
st.write(raw_table)
def fetch_feature_flags() -> set[str]:
default_features = ['summary', 'monthly_spending', 'spending_by_category']
optional_features = ['raw_table']
return set(
st.sidebar.multiselect('Features',
default_features + optional_features,
default_features))
import pandas as pd
import streamlit as st
def construct_timestamp_index(data: pd.DataFrame) -> pd.DataFrame:
data.index = pd.to_datetime(data['Timestamp (UTC)'],
format='%Y-%m-%d %H:%M:%S')
return data.drop(columns=['Timestamp (UTC)'])
def upload_csv(hint: str) -> pd.DataFrame:
uploaded_file = st.sidebar.file_uploader(label=hint)