This file contains 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
#!/usr/bin/env bash | |
set -ex | |
DISK=/dev/sda | |
SYSTEM_PART_NR=1 | |
SYSTEM_PART_INFO=$(sgdisk $DISK -i $SYSTEM_PART_NR) | |
SYSTEM_PART_SIZE="10G" |
This file contains 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
#!/usr/bin/env python3 | |
import requests | |
def requestMovie(baseURL, headers): | |
url = baseURL + "/api/v3/movie" | |
print("Queueing rescan command to Radarr via %s." % url) | |
r = requests.get(url, headers=headers) | |
command = r.json() | |
return command |
This file contains 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
#!/usr/bin/env bash | |
TODAY="$(date +%Y%m%d)" | |
TRANSFER_FOLDER="transfer-${TODAY}" | |
APP_FOLDER="${HOME}/app" | |
DB_NAME="${DB_NAME:-$USER}" | |
mkdir "${TRANSFER_FOLDER}" | |
{ |
This file contains 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
#!/usr/bin/env bash | |
TARGET_HOST="$1" | |
TARGET_PORT="$2" | |
echo "starting tcpdump" | |
tcpdump -w "tcp-test-client_${TARGET_PORT}_%Y%m%d-%H%M%S.pcap" -G 3600 "ip6 and (src port $TARGET_PORT or dst port $TARGET_PORT)" & | |
TCPDUMP_PID=$! | |
function cleanup() |
This file contains 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
use std::collections::HashMap; | |
struct Cacher<T, U, V> | |
where | |
T: Fn(U) -> V, | |
U: std::cmp::Eq + std::hash::Hash + Copy, | |
V: Copy, | |
{ | |
calculation: T, | |
value: HashMap<U, V>, |
This file contains 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
fn is_vowel(c: char) -> bool { | |
let lc = c.to_lowercase().next(); | |
if let None = lc { | |
return false; | |
} | |
let lc = lc.unwrap(); | |
match lc { | |
'a' | 'e' | 'i' | 'o' | 'u' => true, | |
_ => false, |
This file contains 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
use std::collections::HashMap; | |
use std::cmp::Ordering; | |
fn gen_mean(input: &Vec<u32>) -> String { | |
let sum = input.iter().fold(0, |acc, x| acc + x); | |
return (sum as usize / input.len()).to_string(); | |
} | |
fn gen_median(input: &Vec<u32>) -> String { |
This file contains 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
# locale redirect | |
if ($http_accept_language ~* "^en") { | |
set $locale_specific_subdomain "en"; | |
} | |
if ($http_accept_language ~* "^fr") { | |
set $locale_specific_subdomain "fr"; | |
} | |
if ($http_accept_language ~* "^da") { |
This file contains 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
<?php | |
function determineFittingFontScale( | |
$pdfLib, | |
int $textFlow, | |
array $fitTextFlowOptions, | |
array $maxDims | |
): float { | |
$fontScale = 1.0; | |
while ($fontScale >= 0.3) { |
This file contains 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
<?php | |
$p = new PDFlib(); | |
$p->set_option("stringformat=utf8"); | |
$p->begin_document("", ""); | |
/* Create an A4 Landscape page */ | |
$p->begin_page_ext(0, 0, "width=a4.height height=a4.width"); | |
$createTextFlowOptList = [ | |
'hyphenchar=none', |
NewerOlder