A few cleanup scripts for use in packer AMI builds.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jenkins.model.Jenkins.getInstance().getUpdateCenter().getSites().each { site -> | |
site.updateDirectlyNow(hudson.model.DownloadService.signatureCheck) | |
} | |
hudson.model.DownloadService.Downloadable.all().each { downloadable -> | |
downloadable.updateNow(); | |
} | |
def plugins = jenkins.model.Jenkins.instance.pluginManager.activePlugins.findAll { | |
it -> it.hasUpdate() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -x | |
#JENKINS_PLUGINS_PATH="${JENKINS_PLUGINS_PATH:-/usr/share/jenkins/ref/plugins}" | |
JENKINS_PLUGINS_PATH="${JENKINS_PLUGINS_PATH:-/usr/share/jenkins/ref/plugins}" | |
REMOVE_PLUGINS_LIST_PATH="${REMOVE_PLUGINS_LIST_PATH:-/usr/share/jenkins/ref/remove_plugins_list.txt}" | |
echo $JENKINS_PLUGINS_PATH | |
echo $REMOVE_PLUGINS_LIST_PATH | |
for line in `cat ${REMOVE_PLUGINS_LIST_PATH}` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.jenkinsci.plugins.scriptsecurity.scripts.* | |
ScriptApproval sa = ScriptApproval.get(); | |
//list pending approvals | |
for (ScriptApproval.PendingScript pending : sa.getPendingScripts()) { | |
println "Pending Approved : " + pending.script | |
} | |
//list pending signatures | |
for (ScriptApproval.PendingSignature pending : sa.getPendingSignatures()) { | |
println "Pending Signature : " + pending.signature |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -x | |
cat <<EOF > /etc/rsyslog.d/01_filters.conf | |
if \$programname == 'systemd' and \$msg contains "Started Session" then stop | |
if \$programname == 'systemd' and \$msg contains "Starting Session" then stop | |
if \$programname == 'systemd' and \$msg contains "Created slice" then stop | |
if \$programname == 'systemd' and \$msg contains "Starting user-" then stop | |
if \$programname == 'systemd' and \$msg contains "Stopping user-" then stop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
packer build packer.json 2>&1 | sudo tee output.txt | |
tail -2 output.txt | head -2 | awk 'match($0, /ami-.*/) { print substr($0, RSTART, RLENGTH) }' > sudo ami.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
# members | |
# List the members of a group on Mac | |
# Usage: members mygroupname | |
members () { dscl . -list /Users | while read user; do printf "$user "; dsmemberutil checkmembership -U "$user" -G "$*"; done | grep "is a member" | cut -d " " -f 1; }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
# source: ethanj's script under https://github.com/pypa/pipenv/wiki/Run-pipenv-shell-automatically#zsh | |
# automatically run "pipenv shell" if we enter a pipenv project subdirectory | |
# if opening a new terminal, preserve the source directory | |
PROMPT_COMMAND='prompt' | |
precmd() { eval "$PROMPT_COMMAND" } | |
function prompt() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# virtualenv-auto-activate.sh | |
# | |
# Installation: | |
# Add this line to your .bashrc or .bash-profile: | |
# | |
# source /path/to/virtualenv-auto-activate.sh | |
# | |
# Go to your project folder, run "virtualenv .venv", so your project folder | |
# has a .venv folder at the top level, next to your version control directory. |
See below