Skip to content

Instantly share code, notes, and snippets.

View NeckBeardPrince's full-sized avatar

Adam Stracener NeckBeardPrince

View GitHub Profile
# Source: https://gist.github.com/9774cf9d4d39b02bb01db928d9f3a0d2
####################################################
# Kubernetes Native Policy Management With Kyverno #
# https://youtu.be/DREjzfTzNpA #
####################################################
# Referenced videos:
# - How to apply policies in Kubernetes using Open Policy Agent (OPA) and Gatekeeper: https://youtu.be/14lGc7xMAe4
# - K3d - How to run Kubernetes cluster locally using Rancher k3s: https://youtu.be/mCesuGk-Fks
@particledecay
particledecay / ssh_target_group.sh
Created August 28, 2019 20:48
SSH to all instances within an AWS target group
#!/bin/bash
ssh_user=joey.espinosa
aws_region=us-west-1
export target_group=$1
# grab AWS info
target_arn=$(aws elbv2 describe-target-groups --region ${aws_region} --query "TargetGroups[?TargetGroupName==\`${target_group}\`].TargetGroupArn" --output text)
instance_ids=$(aws elbv2 describe-target-health --target-group-arn $target_arn --region ${aws_region} --query "TargetHealthDescriptions[*].Target.Id" --output text)
ip_addresses=( $(aws ec2 describe-instances --region ${aws_region} --instance-ids $instance_ids --query "Reservations[*].Instances[*].PrivateIpAddress" --output text ) )
@fnky
fnky / ANSI.md
Last active May 28, 2024 12:08
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@psxvoid
psxvoid / delete-evicted-pods-all-namespaces.sh
Created August 6, 2018 14:41
Delete evicted pods from all namespaces (also ImagePullBackOff and ErrImagePull)
#!/bin/sh
# based on https://gist.github.com/ipedrazas/9c622404fb41f2343a0db85b3821275d
# delete all evicted pods from all namespaces
kubectl get pods --all-namespaces | grep Evicted | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod
# delete all containers in ImagePullBackOff state from all namespaces
kubectl get pods --all-namespaces | grep 'ImagePullBackOff' | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod
# delete all containers in ImagePullBackOff or ErrImagePull or Evicted state from all namespaces
@jpswade
jpswade / devops_best_practices.md
Last active May 23, 2024 11:12
Devops Best Practices Checklist

Find the original here article here: Devops Best Practices

DevOps started out as "Agile Systems Administration". In 2008, at the Agile Conference in Toronto, Andrew Shafer posted an offer to moderate an ad hoc "Birds of a Feather" meeting to discuss the topic of "Agile Infrastructure". Only one person showed up to discuss the topic: Patrick Debois. Their discussions and sharing of ideas with others advanced the concept of "agile systems administration". Debois and Shafer formed an Agile Systems Administrator group on Google, with limited success. Patrick Debois did a presentation called "Infrastructure and Operations" addressing

@pecigonzalo
pecigonzalo / bastion
Last active November 13, 2019 18:02
SSH bastion lookup
#!/usr/bin/env bash
set -e # exit on command errors
set -o nounset # abort on unbound variable
set -o pipefail # capture fail exit codes in piped commands
# set -x
# Config:
# ~/.ssh/config
# Host i-*
@alirobe
alirobe / reclaimWindows10.ps1
Last active May 27, 2024 21:14
This Windows 10 Setup Script turns off a bunch of unnecessary Windows 10 telemetery, bloatware, & privacy things. Not guaranteed to catch everything. Review and tweak before running. Reboot after running. Scripts for reversing are included and commented. Fork of https://github.com/Disassembler0/Win10-Initial-Setup-Script (different defaults). N.…
###
###
### UPDATE: For Win 11, I recommend using this tool in place of this script:
### https://christitus.com/windows-tool/
### https://github.com/ChrisTitusTech/winutil
### https://www.youtube.com/watch?v=6UQZ5oQg8XA
### iwr -useb https://christitus.com/win | iex
###
###
@carlessanagustin
carlessanagustin / nginx-ssl.conf
Created February 19, 2016 07:49
Nginx with SSL to Jenkins
upstream jenkins {
server 127.0.0.1:8080 fail_timeout=0;
}
server {
listen 80;
# server_name jenkins.domain.tld;
return 301 https://$host$request_uri;
}