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
# put this in ~/.bashrc | |
export SSH_AUTH_SOCK=/tmp/.ssh-socket | |
ssh-add -l > /dev/null | |
if [ $? = 2 ]; then | |
rm -f $SSH_AUTH_SOCK | |
echo Starting new ssh-agent... | |
eval $(ssh-agent -a $SSH_AUTH_SOCK) > /dev/null | |
ssh-add && echo "ssh-agent set up successfully with the following keys:" && ssh-add -l | |
fi |
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
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/bash | |
# Thorough syntax check for #!/bin/sh scripts. | |
# (For bash scripts, shellcheck by itself is enough) | |
set -eu | |
for f in "$@"; do | |
dash -n "$f" && \ | |
shellcheck -x "$f" && \ |
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
function notify($notificationTitle) { | |
$app = '{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\WindowsPowerShell\v1.0\powershell.exe' | |
[void][Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | |
# Fetch empty template | |
$templateType = [Windows.UI.Notifications.ToastTemplateType]::ToastText01 | |
$template = [xml]([Windows.UI.Notifications.ToastNotificationManager]::GetTemplateContent($templateType).getXml()) | |
#Convert to .NET type for XML manipuration | |
[void]$template.GetElementsByTagName("text").AppendChild($template.CreateTextNode($notificationTitle)) |
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 | |
# 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
// This goes in ~/.gradle/init.d/tmpfs.gradle | |
def ramdir='/tmp/gradle' | |
gradle.projectsLoaded { | |
rootProject.allprojects { | |
buildDir = "${ramdir}${project.path}/build" | |
//println "${project.name}.buildDir = ${buildDir}" | |
} |
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 | |
# Create and launch an alpine chroot | |
# If /tmp is not tmpfs, change this to /dev/shm | |
rootfs=/tmp/alpine | |
set -eu | |
if ! [ -f $rootfs/etc/resolv.conf ]; then | |
if ! [ -f ~/Downloads/alpine.tar.gz ]; then | |
curl -Lf -o ~/Downloads/alpine.tar.gz http://dl-cdn.alpinelinux.org/alpine/v3.11/releases/x86_64/alpine-minirootfs-3.11.6-x86_64.tar.gz |
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 |