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 / whois.php
Last active February 11, 2024 08:49
Simple PHP whois lookup script
<form method=GET action="<?php htmlentities(basename(_FILE_)); ?>">
<input type=text name="q" value="<?php echo htmlentities($_REQUEST["q"]); ?>">
<input type=submit value="WHOIS">
</form>
<pre><?php
/*
* whois.php
*/
main();
@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 / matteromost-solarized-light-theme.json
Last active December 6, 2022 18:19
Mattermost Solarized Light theme
{"sidebarBg":"#e8e4d9","sidebarText":"#2e2e2e","sidebarUnreadText":"#cb4b16","sidebarTextHoverBg":"#DCD6C6","sidebarTextActiveBorder":"#cb4b16","sidebarTextActiveColor":"#cb4b16","sidebarHeaderBg":"#e8e6df","sidebarHeaderTextColor":"#424242","onlineIndicator":"#52adad","awayIndicator":"#d4b579","dndIndicator":"#f74343","mentionBj":"#ffffff","mentionColor":"#ffffff","centerChannelBg":"#fdf6e3","centerChannelColor":"#444444","newMessageSeparator":"#f2777a","linkColor":"#2aa198","buttonBg":"#cb4b16","buttonColor":"#ffffff","errorTextColor":"#fd5960","mentionHighlightBg":"#ebd8c2","mentionHighlightLink":"#cb4b16","codeTheme":"github","mentionBg":"#cb4b16"}
@dale-c-anderson
dale-c-anderson / install_node_exporter.centos6.sh
Created October 3, 2018 20:37
Install and configure Prometheus Node Exporter on a CentOS 6 box
#!/bin/bash
# Install Prometheus Node Exporter on CentOS 6.
set -eu
set -o pipefail
set -x
REPOFILE='/etc/yum.repos.d/coprs.ibotty.prometheus-exporters.repo'
INSTALLED=0
@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 / certbot-auto-fake
Last active October 3, 2021 08:55
A fake LetsEncrypt simulator for use in testing inside isolated environments. Creates self signed certs instead of real ones.
#!/bin/bash -ue
################################################################################
# Simulates the certificate files that LetsEncrypt creates, creating self signed ones instead
# Ignores all arguments except the last one, which is assumed to be your FQDN.
################################################################################
if [ $# -lt 1 ]; then
>&2 echo "I need at least a FQDN to do anything."
exit 1
@dale-c-anderson
dale-c-anderson / ip.php
Last active February 19, 2021 18:09
A php page that simply spits out the IP address of the visitor. Served as plain text for terminal (curl), HTML for browsers.
<?php
/**
##################
ip.php
##################
A php page that simply displays the IP address of the visitor.
Serves plain text by default, serves a pretty html version by request, or if