Skip to content

Instantly share code, notes, and snippets.

@DTTerastar
DTTerastar / traefik_dyn_install.sh
Last active September 16, 2024 13:54
Create a simple dynamic config for a locally running server
#!/bin/bash
set -e
# Set variables
TRAEFIK_DYNAMIC_DIR="/etc/traefik/dyn"
# Check if script is run as root
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
#!/bin/bash
set -e
# Set variables
TRAEFIK_VERSION="v3.1.2"
TRAEFIK_PACKAGE_URL="https://github.com/traefik/traefik/releases/download/${TRAEFIK_VERSION}/traefik_${TRAEFIK_VERSION}_linux_amd64.tar.gz"
TRAEFIK_INSTALL_DIR="/usr/local/bin"
TRAEFIK_CONFIG_DIR="/etc/traefik"
TRAEFIK_DYNAMIC_DIR="/etc/traefik/dyn"
SIGABRT: abort
PC=0x473521 m=0 sigcode=0
goroutine 0 [idle]:
runtime.futex()
runtime/sys_linux_amd64.s:557 +0x21 fp=0x7ffd10e82d98 sp=0x7ffd10e82d90 pc=0x473521
runtime.futexsleep(0x0?, 0x0?, 0x1fd10e82e40?)
runtime/os_linux.go:69 +0x30 fp=0x7ffd10e82de8 sp=0x7ffd10e82d98 pc=0x4376b0
runtime.notesleep(0x2e45ba8)
runtime/lock_futex.go:160 +0x87 fp=0x7ffd10e82e20 sp=0x7ffd10e82de8 pc=0x40eb87
2024-03-13T20:40:32.389Z [DEBUG] policy_eval.broker: dequeue eval: queue=cluster
2024-03-13T20:40:32.389Z [DEBUG] policy_eval.broker: waiting for eval: queue=cluster
2024-03-13T20:40:32.555Z [DEBUG] policy_eval.broker: enqueue eval: eval_id=5a183123-8682-efb8-212c-3e7dbfe1ca41 policy_id=0c3bb192-6669-19ea-ef5b-36498c73814e queue=horizontal token=""
2024-03-13T20:40:32.555Z [DEBUG] policy_eval.broker: eval enqueued: eval_id=5a183123-8682-efb8-212c-3e7dbfe1ca41 policy_id=0c3bb192-6669-19ea-ef5b-36498c73814e queue=horizontal token=""
2024-03-13T20:40:32.555Z [DEBUG] policy_eval.broker: eval dequeued: queue=horizontal eval_id=5a183123-8682-efb8-212c-3e7dbfe1ca41 policy_id=0c3bb192-6669-19ea-ef5b-36498c73814e token=f46a1bd9-38b5-caeb-4440-465f62f2b1fa
2024-03-13T20:40:32.555Z [DEBUG] policy_eval.worker: received policy for evaluation: id=498f9ae4-2550-3c30-0fa2-cdc42e1b461d policy_id=0c3bb192-6669-19ea-ef5b-36498c73814e queue=horizontal target=nomad-target
2024-03-13T20:40:32.556Z [DEBUG] policy_eval.worker.check_
esphome:
name: smart-speaker
friendly_name: Smart Speaker
name_add_mac_suffix: false
min_version: 2023.4.4
esp32:
board: esp-wrover-kit
framework:
version: 2.0.5
"""iCloud account."""
from __future__ import annotations
from datetime import timedelta
import logging
import operator
from typing import Any
from pyicloud import PyiCloudService
from pyicloud.exceptions import (
@DTTerastar
DTTerastar / FixedInstanceProfileAwsCredentials
Created June 15, 2020 15:07
Fixed implementation of InstanceProfileAwsCredentials
internal class FixedInstanceProfileAwsCredentials : AWSCredentials, IDisposable
{
private static readonly Lazy<FixedInstanceProfileAwsCredentials> InstanceLazy = new Lazy<FixedInstanceProfileAwsCredentials>(() => new FixedInstanceProfileAwsCredentials());
private readonly Task _credentialsRetrieverTimer;
private readonly SemaphoreSlim _semaphore = new SemaphoreSlim(1);
private bool _disposed;
private ImmutableCredentials _lastRetrievedCredentials;
private FixedInstanceProfileAwsCredentials()
<?xml version='1.0' encoding='ISO-8859-1' ?>
<!DOCTYPE log4j:configuration SYSTEM "./log4j.dtd">
<!--
To enable debug logging remove XML comments in the lines below that are marked with "DELETE THIS LINE FOR ENABLING DEBUG LOGGING" text.
The file can be modified without application restart, but some changes can still require restart to take effect.
You might also need to increase the number of files to store to prevent logs from quick rotation
<param name="maxBackupIndex" value="20"/>
-->
@DTTerastar
DTTerastar / BetterRandom
Created January 23, 2014 18:33
This implements Mersenne Twister PseudoRandom number generator
/// <summary>
/// This implements Mersenne Twister PseudoRandom number generator
/// </summary>
public class BetterRandom : Random
{
/* Period parameters */
private const int N = 624;
private const int M = 397;
private const uint UpperMask = 0x80000000; /* most significant w-r bits */
@DTTerastar
DTTerastar / EnsureUniqueFilename
Last active January 4, 2016 06:49
EnsureUniqueFilename helps to generate a unique filename
public class EnsureUniqueFilename
{
private readonly string _path;
private readonly Dictionary<string, bool> _used = new Dictionary<string, bool>(StringComparer.OrdinalIgnoreCase);
private string _format = "{0}_{1}{2}";
private int _startingSeq = 2;
public EnsureUniqueFilename(string path)
{
_path = path;