Skip to content

Instantly share code, notes, and snippets.

View taylorsmithgg's full-sized avatar

Taylor Smith taylorsmithgg

  • Independent
  • United States
View GitHub Profile
@jpbruckler
jpbruckler / AutomateDCRAssignment.ps1
Created May 14, 2024 12:48
Assigns Data Collection Rules to Windows Servers
<#
.SYNOPSIS
Assigns Data Collection Rules to Azure VMs and Azure Arc servers.
.DESCRIPTION
This script connects to Azure, retrieves all Windows Azure VMs and Azure Arc
servers from specified subscriptions, and applies Data Collection Rules to
them. It is intended to streamline the setup of monitoring across both Azure
VM and Azure Arc environments by automating the association of DCRs.
@wperron
wperron / secrets.awk
Last active November 4, 2024 14:20
Detecting secrets in source code with ✨ RegEx ✨
# Credit to https://github.com/dxa4481/truffleHogRegexes/blob/master/truffleHogRegexes/regexes.json
# For the different secret key patterns
#
# Usage: awk -f secrets.awk path/to/your/project/**/*.(js|ts)
/(xox[pborsa]-[0-9]{12}-[0-9]{12}-[0-9]{12}-[a-z0-9]{32})/ {printf "%s:%s %s", FILENAME, NR, $0; nextfile} # Slack Token
/-----BEGIN RSA PRIVATE KEY-----/ {printf "%s:%s %s", FILENAME, NR, $0; nextfile} # RSA private key
/-----BEGIN DSA PRIVATE KEY-----/ {printf "%s:%s %s", FILENAME, NR, $0; nextfile} # SSH (DSA) private key
/-----BEGIN EC PRIVATE KEY-----/ {printf "%s:%s %s", FILENAME, NR, $0; nextfile} # SSH (EC) private key
/-----BEGIN PGP PRIVATE KEY BLOCK-----/ {printf "%s:%s %s", FILENAME, NR, $0; nextfile} # PGP private ke
@ltupin
ltupin / sh
Created February 28, 2019 14:41
Filter failed kubernetes jobs to delete it
#Should be a job too :-D
# With xargs (on all namespaces)
kc get jobs -o=jsonpath='{range .items[?(@.status.conditions[0].type == "Failed")]}{.metadata.name}{"\t"}{.metadata.namespace}{"\n"}{end}' --all-namespaces | \
xargs -n2 sh -c 'kubectl delete jobs $0 --namespace=$1'
# For loop (only in the current namespace)
for i in $(kc get jobs -o=jsonpath='{range .items[?(@.status.conditions[0].type == "Failed")]}{.metadata.name}{"\n"}{end}');
do kubectl delete jobs $i; done
@ebbp0
ebbp0 / aws_queue.py
Last active April 21, 2022 23:15
AWS SQS send/receive with multi-threading
"""Snippet for just-add-water multithreading with AWS SQS service.
Does not currently check for send errors but will one day...
@author Elliot BP (github: ebbp0) <[email protected]>
"""
import json
from multiprocessing import Process, Pipe
from typing import Any
@petitviolet
petitviolet / nginx_deployment.yaml
Created March 11, 2018 11:04
sample Nginx configuration on Kubernetes using ConfigMap to configure nginx.
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-conf
data:
nginx.conf: |
user nginx;
worker_processes 3;
error_log /var/log/nginx/error.log;
events {
@valdemon
valdemon / config.yml
Last active May 9, 2019 13:11
Enable ECR (AWS) registries for Spinnaker with Kubernetes provider
# A part of the Halyard config file declaring the ECR registries.
# There can be multiple registries, each in different AWS account.
# In this example there are 3 "stages" accounts - dev, stage & live.
# NOTE: The declared password files must exist and provide valid base64 encoded values,
# otherwise Halayrd will endup with an exception during deployment.
# The values can be fake, they will be updated later by the Kubernetes Job (see 2-nd attached file).
# NOTE: replace ${YOUR_DEV_AWS_ACCOUNT_ID} ${YOUR_DEV_AWS_REGION}
# with appropriate values (same for STAGE & LIVE).
dockerRegistry:
@jujhars13
jujhars13 / sftp.yaml
Last active November 20, 2024 00:30
kubernetes pod example for atmoz/sftp
apiVersion: v1
kind: Namespace
metadata:
name: sftp
---
kind: Service
apiVersion: v1
metadata:
@oifland
oifland / Jenkinsfile
Last active July 15, 2024 06:36
Loops in Jenkinsfiles
// Related to https://issues.jenkins-ci.org/browse/JENKINS-26481
abcs = ['a', 'b', 'c']
node('master') {
stage('Test 1: loop of echo statements') {
echo_all(abcs)
}
stage('Test 2: loop of sh commands') {
@cherti
cherti / alert.sh
Created December 9, 2016 13:47
send a dummy alert to prometheus-alertmanager
#!/bin/bash
name=$RANDOM
url='http://localhost:9093/api/v1/alerts'
echo "firing up alert $name"
# change url o
curl -XPOST $url -d "[{
\"status\": \"firing\",