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
#!/bin/sh | |
set -euo pipefail | |
if [[ $# -lt 1 || $1 == "--help" ]]; then | |
echo "Usage: $0 <target_path> <size_in_gb> (default: 10)" | |
exit 0 | |
fi | |
GiB_IN_BYTES=1073741824 |
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 logging | |
import sys | |
import json | |
import uuid | |
logger = logging.getLogger("andotp-to-aegis") | |
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
import logging | |
import os | |
import json | |
import httpx | |
logger = logging.getLogger(__name__) | |
class AWSSecretsConfig: | |
_TOKEN = os.environ.get("AWS_SESSION_TOKEN") |
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
export AWS_PROFILE=default | |
aws configure set region $AWS_DEFAULT_REGION --profile $AWS_PROFILE | |
aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID --profile $AWS_PROFILE | |
aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY --profile $AWS_PROFILE | |
aws configure set aws_session_token $AWS_SESSION_TOKEN --profile $AWS_PROFILE | |
unset AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN AWS_REGION |
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
// !! DO NOT DISABLE | |
// The WP Admin UI enumerates all sites so if this | |
// is disabled the UI will take forever to load | |
function remove_admin_toolbar_items( $bar ) { | |
$bar -> remove_node( 'wp-logo' ); | |
// Remove "My Sites" item if not primary site | |
if (get_current_blog_id() != 1 ) { | |
$bar -> remove_node( 'my-sites' ); |
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
import logging | |
import re | |
import os | |
import sys | |
import xml | |
import json | |
import time | |
import httpx | |
import asyncio | |
import xmltodict |
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
def sort_dict(dictionary: dict) -> dict: | |
LIST_KEYS = ["priority", "clientId", "providerId", "clientScope", "alias", "name"] | |
def _get_list_sort_key(d: dict): | |
for key in LIST_KEYS: | |
if key in d: | |
return d[key] | |
return d[sorted(d.keys())[0]] | |
def _sort_dict(obj: any): |
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
import httpx | |
import jwt | |
from json import JSONDecodeError | |
from datetime import datetime, timezone, timedelta | |
from urllib.parse import urlunsplit, urlencode | |
class InsidedAdminError(Exception): | |
pass |
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
import logging | |
import httpx | |
from urllib.parse import urlunsplit, urlencode | |
logger = logging.getLogger(__name__) | |
class SkilljarAdminError(Exception): | |
pass |
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
import secrets | |
import random | |
import string | |
# Source: https://www.geeksforgeeks.org/generating-strong-password-using-python/ | |
def generate_password(length: int, use_symbols: bool = False): | |
ALL_CANDIDATES = string.ascii_letters + string.digits | |
password = [ | |
secrets.choice(string.digits), |
NewerOlder