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
// Created by Philip Trauner on 29.08.23. | |
import SwiftUI | |
public typealias RGB = (r: CGFloat, g: CGFloat, b: CGFloat) | |
extension Angle: Codable { | |
public func encode(to encoder: Encoder) throws { | |
var container = encoder.singleValueContainer() | |
try container.encode(degrees) |
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 SwiftUI | |
private struct Waiter { | |
let timer: Timer? | |
let waiter: Task<Void, Never> | |
func cancel() { | |
timer?.invalidate() | |
waiter.cancel() | |
} |
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 * as t from "io-ts"; | |
import { createHash } from "node:crypto"; | |
import type { BinaryLike } from "node:crypto"; | |
import { Maybe } from "../../type/utility"; | |
// https://hur.st/bloomfilter | |
/* | |
number of items in the filter → `itemCount` | |
n = ceil(m / (-k / log(1 - exp(log(p) / k)))) |
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 | |
from xml.sax.saxutils import unescape as xml_unescape | |
from urllib.parse import unquote as url_unescape | |
import xml.etree.ElementTree as ET | |
import json | |
from os import mkdir | |
from os.path import exists | |
from sys import argv | |
ANSWERS = {1 : [1], 2 : [2], 3 : [1, 2], 4 : [3], 5 : [1, 3], 6 : [2, 3], 7 : [1, 2, 3], 8 : [4], 9 : [1, 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
# Mac specific, edit to suit your needs | |
cd /Volumes/boot | |
# Enable ssh | |
touch ssh | |
# Append dtoverlay=dwc2 to config.txt | |
if ! grep -Fxq "dtoverlay=dwc2" config.txt | |
then | |
echo "dtoverlay=dwc2" >> config.txt |
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
set -e | |
if [ "$(id -u)" != "0" ]; then | |
echo "This script must be run as root" 1>&2 | |
exit 1 | |
fi | |
# Takes ages on slow hardware | |
OPTIMISED_BUILD=false |
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
#!/bin/bash | |
API_TOKEN="" | |
DOMAIN="" | |
PUBLIC_IPV4=$(curl -s ifconfig.co) | |
RECORD_ID="" | |
curl -s -X PUT -H "Content-Type: application/json" -H "Authorization: Bearer ${API_TOKEN}" -d '{"data":"'"${PUBLIC_IPV4}"'"}' "https://api.digitalocean.com/v2/domains/${DOMAIN}/records/${RECORD_ID}" > /dev/null |
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=Teamspeak Service | |
Wants=network.target | |
[Service] | |
WorkingDirectory=/home/ts3/ts3 | |
User=ts3 | |
ExecStart=/home/ts3/ts3/ts3server_minimal_runscript.sh | |
ExecStop=/home/ts3/ts3/ts3server_startscript.sh stop | |
ExecReload=/home/ts3/ts3/ts3server_startscript.sh restart |