Skip to content

Instantly share code, notes, and snippets.

@bard86
bard86 / Readme.md
Created April 19, 2020 12:35 — forked from fracz/Readme.md
Restore intentionally deleted commits in Git

Restore intentionally deleted commits in Git (remote)

Situation

  1. You own a Git repository server and the developers do not have access to it (i.e. they can only read & write to the repo, but not gc it).
  2. You had a developer that wrote a project for you.
  3. He got angry for whatever reason and deleted all branches from the remote repo. He also push -fed the master branch leaving only one silly commit there.
  4. He escaped from the country leaving you without any code at all (at least this is what he believe in).
  5. You have never cloned the repo to other machine. There were only two copies of it: the developer's one and the server's one.
@bard86
bard86 / Docker.txt
Created April 20, 2020 17:51
Docker commands cheatsheet
docker images --format "{{.Repository}}:{{.Tag}}" | grep -v "none"
@bard86
bard86 / set_aliases.sh
Created April 22, 2020 11:45
Alias set
alias dc='docker-compose'
@bard86
bard86 / install_tools_bamboo_agent.sh
Last active April 23, 2020 22:17
Bamboo agent tools
apt update
apt install git
apt install iputils-ping
apt install net-tools
apt install telnet
curl -L "https://github.com/docker/compose/releases/download/1.25.5/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
@bard86
bard86 / run_squid.sh
Created April 25, 2020 09:45
Squid cache proxy
docker volume create --name squidVolume
docker run --name squid -d -p 3128:3128 -v squidVolume:/var/spool/squid Datadog/squid
# Find process running on port 8080
lsof -i:8080
# Just kill it
kill -9 $(lsof -t -i:8080)
# find process listening on port 9200
lsof -nP -i4TCP:$PORT | grep LISTEN
@bard86
bard86 / kubernetes_add_service_account_kubeconfig.sh
Created May 8, 2020 20:33 — forked from innovia/kubernetes_add_service_account_kubeconfig.sh
Create a service account and generate a kubeconfig file for it - this will also set the default namespace for the user
#!/bin/bash
set -e
set -o pipefail
# Add user to k8s using service account, no RBAC (must create RBAC after this script)
if [[ -z "$1" ]] || [[ -z "$2" ]]; then
echo "usage: $0 <service_account_name> <namespace>"
exit 1
fi
@bard86
bard86 / tokens.md
Created February 5, 2021 19:29 — forked from zmts/tokens.md
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов

OpenJDK 11+ on MacOS X

Manually downloading, extracting and configuring the installation of OpenJDK 11+ is a high-maintenance exercise. Particularly if you need to install and switch between multiple versions of the JDK.

The following options for installing OpenJDK 11+ and switching between versions make the job easier..

Install with Jabba

Jabba is a Java version manager inspired by nvm (Node.js) written in Go.

@bard86
bard86 / macos-ramdisk.md
Created March 19, 2021 18:06 — forked from htr3n/macos-ramdisk.md
Creating RAM disk in macOS

Built-in

diskutil erasevolume HFS+ 'RAM Disk' `hdiutil attach -nobrowse -nomount ram://XXXXX`

where XXXXX is the size of the RAM disk in terms of memory blocks.

Notes: