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
export TOKEN=$(curl -sL -X PUT -H "X-aws-ec2-metadata-token-ttl-seconds: 21600" http://169.254.169.254/latest/api/token) | |
curl -sL -X GET -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/ |
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
services: | |
wordpress: | |
depends_on: | |
- db | |
- mailpit | |
image: wordpress:6.5.3-php8.3-apache | |
restart: always | |
ports: | |
- 8080:80 | |
- 7443:443 |
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
#!/usr/bin/env python3 | |
import argparse | |
import json | |
import subprocess | |
from collections import defaultdict | |
# IE. | |
# parse-state -o terragrunt.tfstate -n terraform.tfstate -m ec2_bastion | |
def parse_args(): |
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 urllib3 | |
import json | |
standard_keys = ['id_bigint', 'worldid_mixed', 'service_body_bigint', 'weekday_tinyint', 'venue_type', 'start_time', 'duration_time', 'time_zone', 'formats', 'lang_enum', 'longitude', 'latitude', 'meeting_name', 'location_text', 'location_info', 'location_street', 'location_city_subsection', 'location_neighborhood', 'location_municipality', 'location_sub_province', 'location_province', 'location_postal_code_1', 'location_nation', 'comments', 'train_lines', 'bus_lines', 'phone_meeting_number', 'virtual_meeting_link', 'virtual_meeting_additional_info', 'root_server_uri', 'format_shared_id_list'] | |
req = urllib3.PoolManager().request("GET", 'https://aggregator.bmltenabled.org/main_server/api/v1/rootservers') | |
root_servers = json.loads(req.data.decode()) | |
root_servers = sorted(root_servers, key=lambda k: k['name']) | |
for root in root_servers: | |
root_info = json.loads(root['serverInfo']) | |
available_keys = root_info['available_keys'].split(',') |
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
#!/usr/bin/env bash | |
# Fetches AWS credentials from a EC2 IAM role and configures them locally for multiple profiles. | |
# Script expects input parameter to be a named Host in your SSH config, then sets AWS creds name using that Host name. | |
# | |
# Configuration | |
# Check for SSH_CONFIG_FILE env var then default to users home dir | |
SSH_CONFIG_FILE="${SSH_CONFIG_FILE:-$HOME/.ssh/config}" | |
readarray -t ssh_hosts < <(grep 'Host ' "$SSH_CONFIG_FILE" | awk '{print $2}' | sort -u) | |
# ANSI color codes for pretty output |
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
#!/usr/bin/env bash | |
normalize_image_name() { | |
local name="$1" | |
local registry | |
if [[ "$name" == *\/* ]]; then | |
registry=${name%%/*} | |
if ! [[ "$registry" == *.* || "$registry" == localhost:[0-9]* ]]; then | |
name="docker.io/${name}" | |
fi |
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 yaml | |
import re | |
from kubernetes import client, config | |
def parse_name(name): | |
if len(name.split("/")) > 1: | |
registry = name.split("/")[0] | |
if not ( | |
re.search("\.", registry) or re.search("localhost:[0-9]+", registry) |
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
<?php | |
private function httpGet(string $url): string | |
{ | |
if (defined('WP_CONTENT_DIR')) { | |
return $this->wordpressGet($url); | |
} else { | |
return $this->guzzleGet($url); | |
} | |
} |
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
<?php | |
function getLangInfo() | |
{ | |
$langs = ['da', 'de', 'en', 'es', 'fa', 'fr', 'it', 'pl', 'pt', 'ru', 'sv']; | |
$ret = []; | |
foreach ($langs as $lang) { | |
$daysOfWeek = []; | |
$lang_name = \Locale::getDisplayLanguage($lang, $lang); |
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
#!/usr/bin/env bash | |
usage () { | |
echo "Usage: kx [OPERATION]" | |
echo " -h Help. Displays this message." | |
echo " -l list contexts" | |
echo " -c get current context" | |
echo " -s set context" | |
echo " -d delete context" | |
} |
NewerOlder