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 | |
# Converts markdown format to clipboard in html format. | |
# Requres Wayland, pandoc, and wl-clipboard. | |
# Usage: | |
# rt-clip - Copy from stdin | |
# rt-clip <file> Copy from a file | |
# rt-clip Copy from clipbaord | |
if [[ "$1" == "-" ]]; then shift; cat |
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
alias FROM='docker run -it --rm' | |
ADD() { curl -sLf "$1" -o "$2"; } | |
alias RUN='' ARG='' ENV='' CMD='' | |
alias LABEL=: EXPOSE=: ENTRYPOINT=: VOLUME=: ONBUILD=: STOPSIGNAL=: HEALTHCHECK=: SHELL=: | |
SHELL() { eval "export SHELL=$1"; } | |
alias WORKDIR=cd | |
USER() { sudo -u "$1" bash --init-file fake_dockerfile.sh; } |
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
@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 | |
# Display memory useage of all running java processes | |
pidof java | xargs -r ps -f | |
echo '' | |
echo $'PID\t% MEM\tTMEM\tGC Time' | |
while true; do | |
for pid in $(pidof java); do | |
echo -n "$pid " |
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
// Usage: dot -Tpdf -o tunic-uml.pdf tunic-uml.dot; xdg-open tunic-uml.pdf | |
digraph G { | |
Presenter -> View; | |
View [shape=box]; | |
Presenter -> Service; | |
Service -> System; |
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 | |
# Screen cast your desktop to Apple TV (airplay). | |
# Usage: airplay-client <server-address> <local-address> | |
# Untested. Likely doesn't work. Airplay V1 only. | |
if [[ "$SERVER_PORT" == "7000" ]]; then | |
# We are the cgi script. | |
echo 'Content-Type: video/h264' |
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
#!/bin/bash | |
# Usage - clone_to_docker.sh <image-name> | |
# This will convert the local distro to a container image and run it. | |
# Also works for WSL. | |
# The container will run as the user that created the image. | |
# If using WSL, you should mount (or symlink) /c to /mnt/c | |
image="wsl" |
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)}}" |