Skip to content

Instantly share code, notes, and snippets.

View moisei's full-sized avatar
🎯
Focusing

Moisei Rabinovich moisei

🎯
Focusing
View GitHub Profile
@moisei
moisei / error-handler.sh
Last active July 24, 2022 10:12
bash stacktrace
# Bash error handler.
# On any error print full stack trace of the failure and exit with the original error code
# set -o errtrace
# inspired by https://gist.github.com/ahendrix/7030300
set -Eeuo pipefail
function errexit() {
local err=$?
set +o xtrace
echo "Error in ${BASH_SOURCE[1]}:${BASH_LINENO[0]}." >&2
foreach ($group in $groups) { Write-Host " === $group == "; (Get-Culture).TextInfo.ToTitleCase((Get-ADGroupMember $group | Sort-Object -property Name | Select Name -ExpandProperty Name | Out-String -Width 100).ToLower()) }
@moisei
moisei / cleanup docker registry
Created November 18, 2020 00:32
cleanup docker registry. delete all the tags from the list of the repositories
# inspired by the https://gist.github.com/jaytaylor/86d5efaddda926a25fa68c263830dac1
registry="http://${registry_user}:${registry_passwd}@${registry_url}/v2"
for repo in `cat repos-todel`; do
for tag in $(curl -sSL "${registry}/${repo}/tags/list" | jq -r '.tags[]?'); do
tagURL="${registry}/${repo}/manifests/${tag}"
sha256=$(curl -H "Accept: application/vnd.docker.distribution.manifest.v2+json" -sSL -I ${tagURL} | awk '$1 == "Docker-Content-Digest:" { print $2 }' | tr -d $'\r')
deleteURL="${registry}/${repo}/manifests/${sha256}"
echo $deleteURL
# curl -v -sSL -X DELETE $deleteUR
done
@moisei
moisei / Kubernetes delete terminating pod
Last active January 15, 2021 20:42
Kubernetes delete terminating pod
https://kubernetes.io/docs/tasks/run-application/force-delete-stateful-set-pod
kubectl patch pod <pod> -p '{"metadata":{"finalizers":null}}'
kubectl delete pods <pod> --grace-period=0 --force
@moisei
moisei / choco-install-all.bat
Last active August 13, 2020 12:49
Chocolatey: fresh windows 10
@REM choco install all the applications from the choco-win-10-fresh file one by one
@echo off
for /f "tokens=* delims=" %%a in ('type choco-win-10-fresh') do (
call choco install -y %%app
)
start chocolateygui
@moisei
moisei / .env
Created March 28, 2020 01:54
docker-compose template
COMPOSE_PROJECT_NAME=template
VAR_FROM_FILE=anyvalue
VAR_FROM_FILE_WITH_THE_SAME_NAME=any_other_value
@moisei
moisei / Sandbox.wsb
Last active March 28, 2020 01:47
Windows sandbox
<Configuration>
<MappedFolders>
<MappedFolder>
<HostFolder>C:\SandBoxShare</HostFolder>
<ReadOnly>true</ReadOnly>
</MappedFolder>
</MappedFolders>
<LogonCommand>
<Command>C:\Users\WDAGUtilityAccount\Desktop\SandBoxShare\init-sandbox.bat</Command>
</LogonCommand>
@moisei
moisei / sqlite to mysql
Created March 21, 2020 01:38
sqlite to mysql
https://github.com/techouse/sqlite3-to-mysql
@moisei
moisei / Easy way to share files over Internet from the command line
Created January 8, 2020 17:39
Easy way to share files over Internet from the command line
https://transfer.sh
curl --upload-file ./hello.txt https://transfer.sh/hello.txt
@moisei
moisei / how to use separate private keys for github bitbucket and other users
Last active January 6, 2020 15:41
how to use separate private keys for github bitbucket and other users
https://superuser.com/questions/232373/how-to-tell-git-which-private-key-to-use
~/.ssh/config
host bitbucket.org
HostName bitbucket.org
IdentityFile ~/.ssh/github_rsa
User git
https://medium.com/@xiaolishen/use-multiple-ssh-keys-for-different-github-accounts-on-the-same-computer-7d7103ca8693