Skip to content

Instantly share code, notes, and snippets.

View rwhelan's full-sized avatar
🤘
Party Hard

Ryan Whelan rwhelan

🤘
Party Hard
View GitHub Profile
@rwhelan
rwhelan / list_cloudflare_list_item.go
Created March 15, 2023 20:50
List Cloudflare List Items
package main
import (
"context"
"errors"
"fmt"
"log"
"os"
"github.com/cloudflare/cloudflare-go"
package main
import (
"bytes"
"context"
"errors"
"fmt"
"os"
"sync"
barbell_weight = 45
# weight_selection = [45, 35, 25, 10, 5, 5, 2.5]
weight_selection = [55, 45, 35, 25, 15, 15, 10, 5, 2.5]
max_possible_weight = int(sum(weight_selection) * 2 + barbell_weight)
class ImpossibleWeight(Exception):
def __init__(self, weight):
self.weight = weight
def calculate_weights(desired_weight):
import json
from subprocess import Popen, PIPE
wg_bin = 'wg'
class WireGuardCommandError(Exception): pass
def _execute_wireguard_command(cmd, stdin=''):
proc = Popen([wg_bin] + cmd, stdout=PIPE, stderr=PIPE, stdin=PIPE)
if stdin != '':
import os
import time
import datetime
import sqlite3
import re
def get_sensors():
sensors = []
for filename in os.listdir("/sys/bus/w1/devices"):
if re.match( r'\w{2}-\w{12}', filename ):