This file contains hidden or 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
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 |
This file contains hidden or 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
[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] |
This file contains hidden or 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
auth_enabled: false | |
server: | |
http_listen_port: 3100 | |
ingester: | |
lifecycler: | |
address: 127.0.0.1 | |
ring: | |
kvstore: |
This file contains hidden or 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 random | |
import subprocess | |
while 1: | |
costprice = random.uniform(1, 100) | |
sellprice = costprice + (costprice * random.uniform(-0.20, 0.50)) | |
profit = sellprice - costprice |
This file contains hidden or 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 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) |
This file contains hidden or 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 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) |
This file contains hidden or 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
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)) |
This file contains hidden or 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
#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 |
This file contains hidden or 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 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)" |
This file contains hidden or 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 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): |