Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block atoa

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
atoa /
Created Nov 15, 2017
delete empty cloudwatch log groups
#!/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
atoa / docker-mount.ps1
Created Sep 26, 2016
mount drive on docker for windows
View docker-mount.ps1
$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}" \
#!/usr/bin/env bash
# from:
#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'
# ssh-agent helper script. runs ssh-agent and adds ~/.ssh/*.pem keys
umask 077
IFS=' '
readonly AGENT_SOCKET="${HOME}/.ssh/.ssh-agent-socket"
readonly AGENT_INFO="${HOME}/.ssh/.ssh-agent-info"
#!/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
atoa / cert_bundle_expand
Created May 16, 2015
expand cert bundle
View cert_bundle_expand
#!/usr/bin/perl -n
$cert++ if /BEGIN/ ;
$certs{ $cert } .= "$_";
foreach $key (keys %certs) {
open(OPENSSL, "|openssl x509 -text");
print OPENSSL $certs{ $key };
atoa /
Created May 8, 2013
shell pipeline to convert a Linux routing table to a prefix based network address CSV. depends on having ipcalc installed.
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
atoa / infuse unlock
Created May 3, 2013
find unlock code Samsung Infuse (possibly other SGS variants). Execute from android shell (e.g. terminal or adb shell)
View infuse unlock
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/'
You can’t perform that action at this time.