Skip to content

Instantly share code, notes, and snippets.

@webguywalker
webguywalker / db-connect-test.php
Created June 8, 2018 17:18 — forked from M165437/db-connect-test.php
Script for a quick PHP MySQL DB connection test.
<?php
# Fill our vars and run on cli
# $ php -f db-connect-test.php
$dbname = 'name';
$dbuser = 'user';
$dbpass = 'pass';
$dbhost = 'host';
$link = mysqli_connect($dbhost, $dbuser, $dbpass) or die("Unable to Connect to '$dbhost'");
@webguywalker
webguywalker / aws_mfa.sh
Created September 25, 2018 19:23
authenticate aws cli when mfa is enabled
#!/bin/bash
help () {
echo 'Usage: sh aws_mfa.sh "$mfa_arn" $mfa_code';
echo "\nWhere:"
echo ' - $mfa_arn, is aws arn to the mfa device found in iam profile'
echo ' - $mfa_code, is code generated by mfa device'
}
if [ "$1" == "-h" ] || [ "$1" == "--help" ]; then
@webguywalker
webguywalker / jenkins-limit-builds.groovy
Last active August 6, 2020 22:41
Jenkins Optimization: limit all builds
// Jenkins: Limit the number of builds per job
// reference: https://support.cloudbees.com/hc/en-us/articles/215549798-Best-Strategy-for-Disk-Space-Management-Clean-Up-Old-Builds
// Jenkins Console: https://{jenkins_host}/script
def daysToKeep = -1
def numToKeep = 7
def artifactDaysToKeep = -1
def artifactNumToKeep = 7
Jenkins.instance.getAllItems(AbstractItem.class).each {
// Jenkins: Cleanup GitPlugin Build Data
// reference: https://plugins.jenkins.io/git/#remove-git-plugin-buildsbybranch-builddata-script
// Jenkins Console: https://{jenkins_host}/script
import hudson.matrix.*
import hudson.model.*
hudsonInstance = hudson.model.Hudson.instance
jobNames = hudsonInstance.getJobNames()
allItems = []
@webguywalker
webguywalker / docker-compose-letsginxpress.yml
Created July 14, 2022 01:00
docker compose v3 | nginx, nginxproxy/docker-gen, nginxproxy/acme-companion, mysql, wordpress
version: "3.8"
services:
###################
nginx-proxy:
image: nginx:1.23-alpine
container_name: nginx-proxy
ports:
- "80:80"