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 sh | |
# | |
# Git grep on multiple repos in descendant directories from cwd | |
set -euo pipefail | |
IFS=$'\n\t' | |
# how many directories to recurse - helps with performance to keep it low | |
# but may miss subdirectories if too low | |
# it can be overriden by setting this variable in the calling shell |
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 sh | |
# AWS cli delete empty cloudwatch log groups | |
aws logs describe-log-groups \ | |
--query 'logGroups[?storedBytes == `0`].logGroupName' --output text | \ | |
xargs -r -n1 aws logs delete-log-group --log-group-name |
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
$drive = $env:homedrive.Substring(0,1) | |
$ip = Get-NetIPConfiguration -InterfaceAlias "vEthernet (DockerNAT)" | Select IPv4Address | |
$unc = "//" + $ip.IPv4Address.IPAddress + "/" + $drive | |
[Environment]::SetEnvironmentVariable("UNC", $unc, "Process") | |
[Environment]::SetEnvironmentVariable("DRIVE", $drive, "Process") | |
docker run -ti --rm --privileged --pid=host -e USERNAME -e USERDOMAIN -e DRIVE -e UNC ubuntu nsenter --target 1 --mount --uts --ipc --net --pid sh -x -c ' | |
[ -d "/${DRIVE}" ] || mkdir "/${DRIVE}" && \ | |
mount.cifs "${UNC}" "/${DRIVE}" \ |
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 | |
# from: http://blog.yohanliyanage.com/2015/05/docker-clean-up-after-yourself/ | |
#https://lebkowski.name/docker-volumes/ | |
#docker rm -v $(docker ps -a -q -f "status=exited") | |
#docker rmi $(docker images -f "dangling=true" -q) | |
docker system df | |
# remove unused volumes: | |
echo '[INFO] removing unused volumes' |
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 | |
# ssh-agent helper script. runs ssh-agent and adds ~/.ssh/*.pem keys | |
PATH="/bin:/usr/bin" | |
umask 077 | |
IFS=' ' | |
readonly AGENT_SOCKET="${HOME}/.ssh/.ssh-agent-socket" | |
readonly AGENT_INFO="${HOME}/.ssh/.ssh-agent-info" |
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 | |
# Docker for Windows drive mount helper | |
# Manually mounts a Windows shared drive inside the MobyLinuxVM virtual machine | |
# (host running on HyperV) so that it is visible to Docker containers. | |
# It enters the moby VM using nsenter via the 'docker4w/nsenter-dockerd' | |
# container. | |
# Then mounts the share drive using the DockerNAT ip address | |
# This can be useful with unix like environments under Windows |
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/perl -n | |
$cert++ if /BEGIN/ ; | |
$certs{ $cert } .= "$_"; | |
END{ | |
foreach $key (keys %certs) { | |
open(OPENSSL, "|openssl x509 -text"); | |
print OPENSSL $certs{ $key }; | |
} | |
} |
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
netstat -rn | grep UG | awk '{print $1 " " $3 " " $2 " " $8}' | \ | |
xargs -n4 sh -c 'ipcalc -p -n $0 $1 ; echo $2 $3' | xargs -n4 | \ | |
sed -e 's/PREFIX=\([0-9]\{1,\}\) NETWORK=\([0-9\.]\{1,\}\)/\2\/\1/; s/ /, /g ' | \ | |
sort -V |
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
dd if=/efs/root/afs/settings/nv_data.bin skip=8 count=4 2>/dev/null | strings | \ | |
grep -v '^0\{8\}$' | (grep '^[0-9]\{8\}' || echo 'ERROR - Unlock code not found' >&2 ) | \ | |
sed -e 's/^\([0-9]\{8\}$\)/UNLOCK CODE: \1/' |