Skip to content

Instantly share code, notes, and snippets.

View tuck1s's full-sized avatar

tuck1s tuck1s

View GitHub Profile
#!/usr/bin/env python3
# External dependencies: https://github.com/treyhunner/names
import random, names
count_default = 10 # Default length of list
def random_n_digits(n):
s = ''
for i in range(n):
s += random.choice('0123456789')
package main
import (
"constraints"
"fmt"
)
type Number interface {
constraints.Integer | constraints.Float | constraints.Complex
}
@tuck1s
tuck1s / README.md
Created August 15, 2022 15:00
Taxi for Email images

This is a placeholder file so we can host images.

#!/usr/bin/env python3
import re, sys, csv, argparse
from datetime import datetime
myTimezone = '' # does rclone log in locale timezone?
def perror(str):
print(str, file=sys.stderr)
# Function operates "in place" by reference on dict d, i.e. has side-effects on d
@tuck1s
tuck1s / push_loki2.py
Created November 5, 2023 17:28
example of grafana/loki api when you need push any log/message from your python script
#!/usr/bin/env python3
# example of grafana/loki api when you need push any log/message from your python script
import requests, time
import names # get some random data
nano_ts = int(time.time()*1e9)
name = names.get_full_name()
# push msg log into grafana-loki
url="http://localhost:3100/loki/api/v1/push"
@tuck1s
tuck1s / leaves.py
Last active November 30, 2023 10:54
from copy import deepcopy
from collections import deque
# Expand a tree to the "leaves"
def leaves_of(item, dependencies):
# return the leaf nodes
def dfs2(item, level, visited):
result = []
if item in dependencies: