Skip to content

Instantly share code, notes, and snippets.

View dex4er's full-sized avatar

Piotr Roszatycki dex4er

View GitHub Profile
#!/bin/bash
# Check if the required argument (prefix) is passed
if [ -z "$1" ]; then
echo "Usage: $0 <prefix>"
exit 1
fi
PREFIX=$1
@dex4er
dex4er / ssh_config
Created June 15, 2025 08:47
ssh ssm
Host i-* mi-*
User root
ProxyCommand sh -c "instance=\$(echo %h | cut -d. -f1); profile=\$(echo %h | cut -d. -f2); profile=\${profile:-\$AWS_PROFILE}; region=\$(echo %h | cut -d. -f3); region=\${region:-\${AWS_REGION:-\$(aws configure get region --profile \${profile:-\$AWS_PROFILE})}}; aws ec2-instance-connect send-ssh-public-key --profile \${profile} --region \${region} --instance-id \${instance} --instance-os-user %r --ssh-public-key file://\${HOME}/.ssh/id_rsa.pub; aws ssm start-session --profile \${profile} --region \${region} --target \${instance} --document-name AWS-StartSSHSession --parameters 'portNumber=%p'"
ServerAliveInterval 60
#!/usr/bin/env bash
_list=($(kubectl get --raw / |grep "^ \"/api"|sed 's/[",]//g'));
echo -e "GROUP\011RESOURCE"
for _api in ${_list[@]}; do
_aruyo=$(kubectl get --raw ${_api} | jq .resources);
if [ "x${_aruyo}" != "xnull" ]; then
kubectl get --raw ${_api} | jq -r ".resources[].name" | xargs -n1 echo ${_api} | tr ' ' '\011' | sort
@dex4er
dex4er / Use_Function_Keys_in_Supported_Apps_else_use_Media_Keys.json
Created May 31, 2025 18:00
Mac OSX: Use Function Keys in Supported Apps, else use Media Keys
{
"description": "Mac OSX: Use Function Keys in Supported Apps, else use Media Keys",
"manipulators": [
{
"conditions": [
{
"bundle_identifiers": [
"^com\\.microsoft\\.VSCode$",
"^com\\.microsoft\\.VSCodeInsiders",
"^com\\.jetbrains\\.goland$",
kubectl get pods --all-namespaces -o jsonpath="{range .items[?(@.spec.runtimeClassName)]}-n {.metadata.namespace} {.metadata.name}{'\n'}{end}" | xargs -n3 echo kubectl delete pod --wait=false | bash
#!/bin/bash
set -eu
set -o pipefail
shopt -s inherit_errexit
if [[ $# -lt 4 ]]; then
echo "Usage: $0 aws_profile_from aws_region_from aws_profile_to aws_region_to [shell patterns]"
exit 99
fi
#!/bin/bash
set -euo pipefail
shopt -s inherit_errexit 2>/dev/null || true
prefix=${prefix:-}
operation=${operation:-=}
while true; do
kubectl get node -L node.kubernetes.io/instance-type,eks.amazonaws.com/nodegroup,karpenter.sh/provisioner-name |
#!/usr/bin/env bash
FILE="$1"
if [[ -z $FILE ]]; then
echo "$0 run-XXX.mocks.tar.gz"
exit 1
fi
if command -v colordiff >/dev/null; then
@dex4er
dex4er / ssm.sh
Last active March 6, 2025 15:26
ssm
#!/usr/bin/env bash
## ssm
##
## Copyright (c) 2023 Piotr Roszatycki <[email protected]>, MIT
set -e
if ! command -v aws >/dev/null; then
echo "Needs aws command."
#!/usr/bin/env bash
## gitlab_clone_all.sh
##
## Copyright (c) 2023,2025 Piotr Roszatycki <[email protected]>, MIT
##
## Requires curl and jq
GROUP_NAME="$1"
shift