Skip to content

Instantly share code, notes, and snippets.

View dale-c-anderson's full-sized avatar

Dale Anderson dale-c-anderson

View GitHub Profile
@dale-c-anderson
dale-c-anderson / boilerplate.py
Created November 8, 2023 00:55
Python 3 Boilerplate
"""
Document Description
"""
__author__ = "Anonymous Coward"
__version__ = "0.1.0"
__license__ = "GPLv3"
import argparse
# from logging.handlers import SysLogHandler
@dale-c-anderson
dale-c-anderson / lambda_my_script.tf
Last active November 8, 2023 00:51
lambda terraform example
# Generic role to allow lambda to execute
resource "aws_iam_role" "lambda_exec" {
name = "lambda_assume_role"
assume_role_policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
Action = "sts:AssumeRole"
Effect = "Allow"
Sid = ""
@dale-c-anderson
dale-c-anderson / AwsEnforceMfaPolicy.json
Last active January 18, 2023 20:00
Replace all instances of XXXXXXXXXXXX with your own aws account id, then attach this policy to groups where you want MFA enforced
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowAllUsersToListAccounts",
"Effect": "Allow",
"Action": [
"iam:ListAccountAliases",
"iam:ListUsers",
"iam:GetAccountSummary"
@dale-c-anderson
dale-c-anderson / purge-solr-service-and-data.sh
Last active June 15, 2022 00:32
Purge solr service and data from ubuntu
#!/bin/bash
set -eu -o pipefail
# --------------------------------------------
# ---------- USE AT YOUR OWN RISK -----------
# --------------------------------------------
# Remove Solr from Ubuntu, as long as it was installed with defaults.
# As of 2022, works for any version of solr on any version of Ubuntu.
@dale-c-anderson
dale-c-anderson / curl-probe.sh
Created November 10, 2021 00:36
curl probe
#!/bin/bash
# -------------------------------------------------------------
# Repeatedly probe a url forever with curl, only keeping the HTTP response code or the failure message from curl. Discard all other output.
# Any args passed to this script will be forwarded to the curl command as-is.
# Activity is profusely logged.
#
# Examples:
#
# Probe from the internet, limiting execution time:
@dale-c-anderson
dale-c-anderson / gitlab-admin-kubernetes-service-account-manifest.yaml
Created October 28, 2020 16:41
gitlab-admin-kubernetes-service-account-manifest.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: gitlab
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: gitlab-admin
@dale-c-anderson
dale-c-anderson / flatten
Last active September 24, 2020 06:05
Flatten a directory structure by one level, preserving the full path of file names
#!/bin/bash
set -eu -o pipefail
# Turn:
# foo/
# ├── bar/
# │ ├── one.txt
# │ ├── two.txt
# ├── baz/
# ├── three.txt
@dale-c-anderson
dale-c-anderson / gist:b171be2e6550eb7302f6857a2913751d
Last active June 9, 2020 16:07
_spf_external_telus_com.nssi.telus.com
; Current, as of 2020-06-09:
_spf_external_telus_com.nssi.telus.com. 900 IN TXT "v=spf1 exists:CL.%{i}.FR.%{l}.F2.%{o}.ext.spf.nssi.telus.com include:_spf_telus.nssi.telus.com" " ip4:46.19.168.11 ip4:54.240.0.0/18 ip4:158.106.103.186 ip4:158.106.103.190 ip4:192.155.71.11 ip4:199.127.232.0/22 ip4:199.255.192.0/22 ip4:204.16.69.140 ip4:205.206.67.163 ip4:205.206.67.179 ip4:207.167.196.14 ip4:208.74.204.5 ip4:209.20.16.33" " include:_spf-ext-a.nssi.telus.com -all"
; Needs to become this, at the earliest opportunity:
_spf_external_telus_com.nssi.telus.com. 900 IN TXT "v=spf1 exists:CL.%{i}.FR.%{l}.F2.%{o}.ext.spf.nssi.telus.com include:_spf_telus.nssi.telus.com" " ip4:46.19.168.11 ip4:54.240.0.0/18 ip4:158.106.103.186 ip4:158.106.103.190 ip4:192.155.71.11 ip4:199.127.232.0/22 ip4:199.255.192.0/22 ip4:204.16.69.140 ip4:205.206.67.163 ip4:205.206.67.179 ip4:207.167.196.14 ip4:208.74.204.5 ip4:209.20.16.33" " ip4:3.96.17.124 ip4:52.60.130.127" " include:_spf-ext-a.nssi.telus.com -all"
@dale-c-anderson
dale-c-anderson / gist:0829da885ee117580407aa8d2f292e2a
Created November 1, 2019 18:00 — forked from mancubus77/gist:447281619be3731461b73dd4a18593c5
Prometheus node exporter init.d (Centos6/RHEL6)
#!/bin/bash
#
# /etc/rc.d/init.d/node_exporter
#
# Prometheus node exporter
#
# description: Prometheus node exporter
# processname: node_exporter
# Source function library.
@dale-c-anderson
dale-c-anderson / keybase.md
Created June 3, 2019 19:14
keybase.io proof

Keybase proof

I hereby claim:

  • I am dale-c-anderson on github.
  • I am dandersonacro (https://keybase.io/dandersonacro) on keybase.
  • I have a public key ASB8FyCb8A6pltKoFsk6MSYmXKc5tu2e39YEELmGPdimtAo

To claim this, I am signing this object: