View send_telegram_message.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import urllib.request | |
import urllib.parse | |
TELEGRAM_TOKEN = os.environ["TELEGRAM_TOKEN"] | |
TELEGRAM_CHANNEL_ID = os.environ["TELEGRAM_CHANNEL_ID"] | |
telegram_url = f"https://api.telegram.org/bot{TELEGRAM_TOKEN}/sendMessage" | |
telegram_url += f"?chat_id={TELEGRAM_CHANNEL_ID}" |
View main.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// go playground | |
// https://go.dev/play/p/3HjtqJlbMnE | |
package main | |
import ( | |
"log" | |
"time" | |
) | |
func main() { |
View .gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
imgs | |
.DS_Store | |
node_modules |
View gas_alert.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# get channel id | |
# https://api.telegram.org/bot<YourBOTToken>/getUpdates | |
# crontab | |
# */5 * * * bash /path/gas_alert.sh 2>&1 | logger -t gas_alert | |
cheapPrice="80" |
View ohlcbtc.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pip install ohlc; apt install jq | |
# with other token, ohlcbtc ETHUSDT | |
ohlcbtc () { | |
token=${1:-BTCUSDT} | |
while true; | |
do | |
ohlc --pab --ha -n <( curl "https://api.binance.com/api/v3/klines?symbol=${token}&interval=1h" 2>/dev/null | jq -r '.[][1:5]|join(" ")' ) | |
sleep 3600 | |
done |
View pool_length.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from web3 import Web3 | |
# https://web3py.readthedocs.io/en/stable/quickstart.html | |
# https://docs.matic.network/docs/develop/network-details/network/ | |
w3 = Web3(Web3.HTTPProvider("https://rpc-mainnet.matic.network")) | |
print(w3.isConnected()) | |
print(w3.eth.block_number) |
View logs_with_color.exs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require Logger | |
Logger.configure_backend(:console, format: "$time $metadata[$level] $levelpad$message\n") | |
# more colores in | |
# https://hexdocs.pm/elixir/1.12/IO.ANSI.html | |
Logger.info("colorful log line", ansi_color: :black) | |
Logger.info("colorful log line", ansi_color: :blue) | |
Logger.info("colorful log line", ansi_color: :cyan) |
View docker_clean_old.service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/systemd/system/docker_clean_old.service | |
[Unit] | |
Description=delete old containers | |
[Service] | |
CPUQuota=20% | |
TimeoutSec=3600 | |
ExecStart=/bin/bash /root/opt/bin/docker_clean_old |
View boxplot_duration_per_project.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import seaborn as sns | |
import matplotlib | |
sns.set(rc={'figure.figsize':(14,12)}) | |
file_name = "duration_per_project.csv" | |
df = pd.read_csv(file_name, ';') |
View batetry_level.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <M5StickCPlus.h> | |
// the setup routine runs once when M5StickC starts up | |
void setup() { | |
// initialize the M5StickC object | |
M5.begin(); | |
// Lcd display | |
M5.Lcd.fillScreen(WHITE); |
NewerOlder