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 pathlib | |
import yaml | |
def _path_representer(dumper, data): | |
return dumper.represent_scalar("!Path", str(data)) | |
def _path_constructor(loader, node): | |
value = loader.construct_scalar(node) | |
return pathlib.Path(value) |
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
def daysToWin(netspaceFraction, confidence = 0.95, challengesPerDay = 4608): | |
losingProbability = 1 - netspaceFraction | |
challengesToWin = math.log(1 - confidence, losingProbability) | |
return challengesToWin / challengesPerDay | |
def earningsPerYear(xchValue_USD, netspaceFraction, confidence = 0.95, challengesPerDay = 4608, xchPerWin = 2): | |
xchPerDay = xchPerWin / daysToWin(netspaceFraction, confidence, challengesPerDay) | |
dailyUSD = xchValue_USD * xchPerDay | |
return dailyUSD * 365 |
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
#!/usr/bin/env python3 | |
import os | |
from pprint import pprint as pp | |
import shutil | |
import socket | |
import sys | |
import typing as th | |
# Largest plot size seen is 108,935,751,977, and smallest is 108,232,347,648. For |
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
[global_tags] | |
srv_loc="home" | |
srv_vtype="real" | |
srv_purpose="chia-plotter" | |
srv_owner="internal" | |
[agent] | |
interval = "60s" | |
round_interval = true | |
metric_batch_size = 1000 |
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
#!/usr/bin/env python | |
# THIS FILE IS A MAAAAAAAAAAAASSIVE HACK QUICKLY MADE FOR THE ONLINE PGCON_2020 | |
# There is DEFINITELY a better way to do this. | |
import argparse | |
import datetime | |
import sched | |
import socket | |
import sys | |
import time |
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 struct | |
try: | |
from time import perf_counter as clock | |
except ImportError: | |
from time import time as clock | |
import asyncio | |
import uvloop | |
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy()) |
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
get_ssh_client_ip() { | |
# Returns (via stdout) the IP address for the currently connected SSH session | |
# - this relies on the ssh server setting the SSH_CLIENT env var (done by openssh, dropbear, etc) | |
pid=$$ # current pid will be checked | |
while [ "$pid" -ne 1 ]; do | |
cip=$(cat /proc/$pid/environ | tr '\0' '\n' | grep 'SSH_CLIENT=' | awk -F'[= ]' '{ print $2 }') | |
[ -n "$cip" ] && break # got it! | |
pid=$(awk '{ print $4 }' /proc/$pid/stat) # the parent pid for the next try | |
done |
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 time | |
import sys | |
DELAY = 0.2 | |
for i in range(10): | |
sys.stdout.write("1") | |
time.sleep(DELAY) | |
sys.stdout.write("\r\n") |
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 sys | |
from PyQt5 import QtCore, QtQml, QtWidgets | |
QML = b''' | |
import QtQuick 2.7 | |
import QtQuick.Window 2.2 | |
import QtQuick.Controls 1.4 | |
import ObjectNameTester 1.0 | |
Window { |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder