Skip to content

Instantly share code, notes, and snippets.

@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 / set_aliases.sh
Created April 22, 2020 11:45
Alias set
alias dc='docker-compose'
@bard86
bard86 / Docker.txt
Created April 20, 2020 17:51
Docker commands cheatsheet
docker images --format "{{.Repository}}:{{.Tag}}" | grep -v "none"
@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 / git-recover-branch.md
Created April 19, 2020 12:34 — forked from jbgo/git-recover-branch.md
How to recover a git branch you accidentally deleted

UPDATE: A better way! (August 2015)

As pointed out by @johntyree in the comments, using git reflog is easier and more reliable. Thanks for the suggestion!

 $ git reflog
1ed7510 HEAD@{1}: checkout: moving from develop to 1ed7510
3970d09 HEAD@{2}: checkout: moving from b-fix-build to develop
1ed7510 HEAD@{3}: commit: got everything working the way I want
70b3696 HEAD@{4}: commit: upgrade rails, do some refactoring
@bard86
bard86 / generate-keys.sh
Created April 10, 2020 16:45
Generate ssh public and private key pair
#!/bin/bash
ssh-keygen -t rsa -C "@gmail.com" -f $HOME/.ssh/id_rsa_file
@bard86
bard86 / git_clone_ssh
Created April 17, 2020 14:47
Git clone ssh sample
GIT_SSH_COMMAND='ssh -i private_key_file' git clone user@host:repo.git
@bard86
bard86 / command_prompt
Created April 12, 2020 08:36
Add to .bash_profile
export PS1="\u@\h [\W]: \[$(tput sgr0)\]"
@bard86
bard86 / set_hostname.sh
Last active April 11, 2020 11:30
Set MacBook host name
#!/bin/bash
set -e
sudo hostname MacBook.local
scutil --set HostName MacBook.local
export PATH="/usr/local/opt/openjdk/bin:$PATH"
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
export PATH="$HOME/.jenv/bin:$PATH"
eval "$(jenv init -)"