Skip to content

Instantly share code, notes, and snippets.

@bard86
bard86 / macbook_update_canonical_software.sh
Last active March 26, 2020 14:01
Update canonical software on MacBook
#!/bin/bash
set -e
sudo softwareupdate --install --all --restart
@bard86
bard86 / macbook_write_defaults.sh
Created March 26, 2020 17:12
Macbook configuration
#!/bin/bash
set -e
defaults write com.apple.Finder AppleShowAllFiles true

Demo:

Spoiler warning

Spoiler text. Note that it's important to have a space after the summary tag. You should be able to write any markdown you want inside the <details> tag... just make sure you close <details> afterward.

console.log("I'm a code block!");
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 -)"
@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 / 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
@bard86
bard86 / command_prompt
Created April 12, 2020 08:36
Add to .bash_profile
export PS1="\u@\h [\W]: \[$(tput sgr0)\]"
@bard86
bard86 / bamboo_server.sh
Last active April 25, 2020 09:26
Run Bamboo and Agent
docker network create \
--driver bridge \
--subnet=192.168.16.0/20 \
atlassianNetwork
docker volume create --name bambooVolume
docker run -d -p 8085:8085 -v bambooVolume:/var/atlassian/application-data/bamboo \
--name bamboo \
--network atlassianNetwork \
@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 / 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