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
@echo off | |
:: Setup an ssd daemon/server on a Windows server box on the internal network. | |
set ROOT=C:\cygwin | |
set PACKAGES=openssh,nc,curl,tmux | |
set SITE=http://cygwin.mirror.constant.com | |
set BASH=%ROOT%\bin\bash --login -c | |
set PACKAGEDIR=%ROOT%\packages | |
echo INSTALL CYGWIN... |
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 | |
# Run containers as if they are locally installed tools. | |
# This is useful for images such as "python" or "maven". | |
# Edit the "image" variable and place in your ~/bin directory. | |
# For "Docker Desktop for Windows" under these environments: | |
# * WSL: if /c is mounted to C: and run from a dir under /c, but /tmp and $HOME volumes should be removed. | |
# * Msys/GitBash: but /tmp volume should be removed. | |
# * Cygwin: Will not work as-is due to path differences. |
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
docker system df | |
df -h | |
# Delete builds and workspaces more 6+ months old | |
find /var/lib/jenkins/jobs -maxdepth 6 -mtime +180 -name build.xml -print0 | xargs -0 -I{} dirname {} | xargs -d '\n' -r rm -rf | |
find /var/lib/jenkins/jobs -maxdepth 3 -mtime +180 -name workspace -print0 | xargs -0 -r rm -rf | |
# Stop containers running more than 2 days, except Jenkins | |
docker ps | grep -E 'days|weeks|months' | grep -Ev "$(hostname)|CONTAINER" | awk '{ print $1; }' | xargs -r docker 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
#!/bin/sh | |
#Usage (local use): docker-over-ssh <server> | |
#Usage (expose): endpoint=0.0.0.0 docker-over-ssh <server> | |
endpoint="${endpoint:-localhost}" | |
ssh -nNT -L $endpoint:2375:/var/run/docker.sock "$1" & | |
export DOCKER_HOST=tcp://$endpoint:2375 | |
echo "Now your docker commands will run on $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
#!/bin/bash | |
# shebang added only to appease shellcheck | |
# Cross-platform for bash. | |
# Worry less about when writting a script that must run on Windows and Linux. | |
# Meant to be used with "source" command in scripts or .bashrc/.zshrc | |
export USER="${USER:-${USERNAME:-$(whoami)}}" | |
export USERNAME="${USERNAME:-$USER}" | |
export HOSTNAME="${HOSTNAME:-${MACHINENAME:-$(hostname)}}" |
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 | |
usage() { sed 's/^ //' >&2 <<<USAGETEXT | |
#TODO: Description of script here. | |
Usage: | |
$(sed -r 's/^#@@ (.*)$/ \1/p' < "${BASH_SOURCE[0]}") | |
Variables: | |
$(sed -r 's/^#@# (.*)$/ \1/p' < "${BASH_SOURCE[0]}") | |
USAGETEXT |
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 | |
# Interpolates variables in a text file | |
# $1 = template filename | |
templatefile="$1" | |
shift | |
eval "$(echo -e "cat <<HEREX\n$(cat "$templatefile")\nHEREX\n")" |
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 | |
# Workaround docker wrapper for git-bash/Msys/Cygwin quirks | |
# Copy this to ~/bin/docker or /usr/local/bin/docker | |
set -euo pipefail | |
export MSYS_NO_PATHCONV=1 | |
export MSYS2_ARG_CONV_EXCL='*' | |
os="$(uname -o)" |
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 | |
# Wrapper over docker-compose to run on remote server. | |
# Usage: | |
# Takes same arguments as docker-compose. | |
# Typical usage: | |
# remote-compose server down |
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 | |
# More seemless integration between git-bash/WSL/Cygwin and Docker for Windows | |
set -euo pipefail | |
( [ -d 'C:\'] && cygpath . > /dev/null; ) || \ | |
{ echo 'Must be run from GitBash, Msys or Cygwin'; exit 1; } | |
export MSYS_NO_PATHCONV=1 | |
USER="$(whoami)" | |
docker run \ |
OlderNewer