Skip to content

Instantly share code, notes, and snippets.

@gregswift
gregswift / terraform.bashrc
Last active September 16, 2020 05:01
terraform_ps1.bashrc
source terraform_ps1.sh
# Obviously manage your PS1 however you are gonna mange it... this is just an example
PS1="\u@\h \W \$(__terraform_ps1) $"
@gregswift
gregswift / colorize.bashrc
Last active September 16, 2020 17:15
colorize.bashrc
function colorize() {
case "${2}" in
black)
FG_COLOR=0
;;
red)
FG_COLOR=1
;;
green)
FG_COLOR=2
@gregswift
gregswift / appgate.bashrc
Last active November 3, 2020 03:45
appgate_ps1.sh
source appgate_ps1.sh
# Obviously manage your PS1 however you are gonna mange it... this is just an example
PS1="\u@\h \W \$(__appgate_ps1) $"
@gregswift
gregswift / gist:0238964d881b2a777e144d2d38b29adf
Created May 15, 2018 17:08
janky jenkins PR pipeline hack
isPR = env.BRANCH_NAME ? env.BRANCH_NAME.startsWith("PR-") : false
if (isPR) {
checkout scm:[$class: 'GitSCM', userRemoteConfigs: [[ url: repoURL, credentialsId: gitCredentialId ]]]
sh "git fetch origin pull/'${numberPR}'/head:'${BRANCH_NAME}'"
sh "git checkout '${BRANCH_NAME}'"
} else {
checkout scm:[$class: 'GitSCM', userRemoteConfigs: [[ url: repoURL, credentialsId: gitCredentialId ]]]
sh 'git checkout master'
}
$ oc import-image manageiq-pods-app --from=docker.io/manageiq/manageiq-pods:app-latest-fine --all=false --confirm
The import completed successfully.
Name: manageiq-pods-app
Namespace: manageiq
Created: Less than a second ago
Labels: <none>
Annotations: openshift.io/image.dockerRepositoryCheck=2017-06-29T15:20:53Z
Docker Pull Spec: 172.16.221.48:5000/manageiq/manageiq-pods-app
Unique Images: 1
@gregswift
gregswift / zabbix-agent-module-docker.spec
Last active June 27, 2017 20:49
RPM package for zabbix-agent-module-docker
%{!?source_ref: %global source_ref master}
%{!?zabbix_version: %global zabbix_version 3.2.6}
%global selinux_variants mls targeted
%define upstream_name zabbix-docker-monitoring
Name: zabbix-agent-module-docker
Version: 1.1
APPLIANCE_ROOT=/opt/manageiq/manageiq-appliance
APPLICATION_INIT_DELAY=15
APP_ROOT_PERSISTENT=/persistent
APP_ROOT_PERSISTENT_REGION=/persistent-region
function enable-bastion() {
function ssh() {
if [[ $1 == \-v* ]]; then
VERBOSITY=${1}
TARGET=${2}
else
unset VERBOSITY
TARGET=${1}
fi
[ -z "$SSO" ] && SSO=${USER}
@gregswift
gregswift / slackclean.py
Created August 15, 2016 16:44
Script to clean up files older than X period from Slack
#!/usr/bin/env python
# Original credit to Santiago L. Valdarrama
# http://www.shiftedup.com/2014/11/13/how-to-bulk-remove-files-from-slack
#
# Script requires SLACK_TEAM and SLACK_TOKEN to be defined in your environment.
# You can get the token from https://api.slack.com/docs/oauth-test-tokens
#
import requests
import json
import calendar
@gregswift
gregswift / Puppetfile
Last active December 18, 2017 02:00
Sourcing puppet modules from yaml
require 'yaml'
mypath = File.expand_path(File.dirname(__FILE__))
# Load configuration from config.yml
conf = YAML::load_file("#{mypath}/Puppetfile.yml")
forge_conf = conf.fetch('forge', nil)
if forge_conf.nil?
forge = ""