It understands files such as:
## global definitions
global:
debug: yes
verbose: no
debugging:
detailed: no
header: "debugging started"
function Convert-PrefixToNetmask { | |
param ( | |
[Parameter(Mandatory = $true)] | |
[int]$PrefixLength | |
) | |
# Create a binary mask string with 1's for the prefix and pad with 0's | |
$binaryMask = ("1" * $PrefixLength).PadRight(32, "0") | |
$octets = @() | |
It understands files such as:
## global definitions
global:
debug: yes
verbose: no
debugging:
detailed: no
header: "debugging started"
# Reference https://stackoverflow.com/a/34407620/13287790 | |
# Requires `jq` | |
# $ echo -n "encode this" | jq -sRj @uri | |
# encode%20this | |
# MY_VAR=$(urlencode "encode this") | |
echo -n "${1}" | jq -sRj @uri |
# Clear all AWS related environment variables | |
function awskill { | |
Remove-Item -Path Env:AWS_DEFAULT_PROFILE -ErrorAction SilentlyContinue | |
Remove-Item -Path Env:AWS_ACCESS_KEY_ID -ErrorAction SilentlyContinue | |
Remove-Item -Path Env:AWS_SECRET_ACCESS_KEY -ErrorAction SilentlyContinue | |
Remove-Item -Path Env:AWS_SECRET_KEY -ErrorAction SilentlyContinue | |
Remove-Item -Path Env:AWS_SECURITY_TOKEN -ErrorAction SilentlyContinue | |
Remove-Item -Path Env:AWS_SESSION_TOKEN -ErrorAction SilentlyContinue | |
} |
# https://github.com/pypa/pip/issues/4551 | |
python -m pip freeze | ForEach-Object{$_.split('==')[0]} | %{python -m pip install --upgrade $_} |
# from https://stackoverflow.com/a/33548037/7706917 | |
# | |
# Explanation: | |
# --- | |
# Switch to the main branch | |
# $> git checkout main | |
# Prune remote branches | |
# $> git remote update origin --prune # Prune remote branches | |
# Get a verbose output of all branches (git reference) | |
# $> git branch -vv |
This application is intended for the private use of its developer. Any unauthorized users which connect to this service should have no expectation of privacy or protection of their data. |
def str_isnullorwhitespace(value: str) -> bool: | |
""" | |
Indicates whether a specified string is `null`, empty, or consists only of | |
white-space characters | |
Parameters | |
----------- | |
value: str | |
The string to test. |
import re | |
def count_sentences(text: str) -> int: | |
""" | |
Count the number of sentences in a given string. | |
This function is based on the Stack Overflow answer https://stackoverflow.com/a/38589115/7706917 | |
Inputs | |
-------- |
@echo off | |
PUSHD %~dp0 | |
:: Do some stuff | |
:: Return to the caller directory | |
POPD |