Skip to content

Instantly share code, notes, and snippets.

View Sean-Bradley's full-sized avatar
📰
https://sbcode.net

SBCODE Sean-Bradley

📰
https://sbcode.net
View GitHub Profile
server:
http_listen_port: 9080
grpc_listen_port: 0
positions:
filename: /tmp/positions.yaml
clients:
- url: http://127.0.0.1:3100/loki/api/v1/push
[Unit]
Description=Loki service
After=network.target
[Service]
Type=simple
User=loki
ExecStart=/usr/local/bin/loki -config.file /usr/local/bin/config-loki.yml
[Install]
auth_enabled: false
server:
http_listen_port: 3100
ingester:
lifecycler:
address: 127.0.0.1
ring:
kvstore:
import time
import random
import subprocess
while 1:
costprice = random.uniform(1, 100)
sellprice = costprice + (costprice * random.uniform(-0.20, 0.50))
profit = sellprice - costprice
import subprocess
import time
while 1:
cmd = '/opt/vc/bin/vcgencmd measure_temp'
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True)
output, error = process.communicate()
tempC = output.split("=")[1].replace("'C", "").strip()
#print(tempC)
import subprocess
import time
cmd = '/opt/vc/bin/vcgencmd measure_temp'
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True)
output, error = process.communicate()
#print(output)
tempC = output.split("=")[1].replace("'C", "").strip()
#print(tempC)
@Sean-Bradley
Sean-Bradley / checkssl.sh
Last active October 20, 2023 17:37
A script to return the number of days before a SSL certificate expires. Visit https://sbcode.net/zabbix/system-run/ for instructions
data=`echo | openssl s_client -servername $1 -connect $1:443 2>/dev/null | openssl x509 -noout -enddate | sed -e 's#notAfter=##'`
ssldate=`date -d "${data}" '+%s'`
nowdate=`date '+%s'`
diff="$((${ssldate}-${nowdate}))"
echo $((${diff}/86400))
#what is the value Pp1d4 in the repos at https://github.com/Sean-Bradley/ECDSA_secp256k1_JordonMatrix_nodejs
#it's used to get the modular cubed root
#I want to find y in equation y² = x³ + 7 in a finite field P
P = 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f
Pp1d4 = 0x3fffffffffffffffffffffffffffffffffffffffffffffffffffffffbfffff0c
#Pp1d4 = P plus 1 divided by 4
#getting cubed root in a finite field
print(pow(16, Pp1d4, P)) # = 4
import requests
import psycopg2
with requests.get("http://127.0.0.1:5000/very_large_request/100000000", stream=True) as r:
conn = psycopg2.connect(dbname="stream_test",
user="postgres", password="postgres")
cur = conn.cursor()
sql = "INSERT INTO transactions (txid, uid, amount) VALUES (%s, %s, %s)"
from flask import Flask, Response, stream_with_context
import time
import uuid
import random
APP = Flask(__name__)
@APP.route("/very_large_request/<int:rowcount>", methods=["GET"])
def get_large_request(rowcount):