Skip to content

Instantly share code, notes, and snippets.

View rmsj's full-sized avatar

Ronaldo Santana rmsj

  • Auckland, New Zealand
View GitHub Profile
@rmsj
rmsj / ssh on mac os.md
Last active August 18, 2022 20:17
[Permanently add SSH keys to Mac OS] #ssh #macos

It is not possible to add private key to Keychain, but you can store passphrase for private key in Keychain. On OSX, the native ssh-add command has a special argument to save the private key's passphrase in the OSX Keychain, which means that your normal login will unlock it for use with ssh. On OSX Sierra and later, you also need to configure SSH to always use the Keychain (see Step 2 below).

Alternatively you can use a key without a passphrase, but if you prefer the security that's certainly acceptable with this workflow.

#Step 1 - Store passphrase in the Keychain In the latest version of MacOS (12.0 Monterey), just do this once:

ssh-add --apple-use-keychain ~/.ssh/[your-private-key] Or in versions of MacOS older than 12.0 Monterey, use:

@rmsj
rmsj / git-tag-rename.sh
Created May 1, 2022 09:36
[Git tag renaming] renaming tags in git repo #git
git tag old new
git tag -d old
git push origin new :old
#other users to remove deleted tags
git pull --prune --tags
@rmsj
rmsj / stripe-credit-card-numbers.md
Created April 7, 2022 02:24 — forked from rymawby/stripe-credit-card-numbers.md
Stripe test credit card numbers for use in development

#Test credit card numbers to use when developing with Stripe

4242424242424242 Visa

4012888888881881 Visa

4000056655665556 Visa (debit)

@rmsj
rmsj / check-port-mac.sh
Created October 1, 2021 04:13
[Mac docker problem 80/443] #mac #docker #port-problem
sudo lsof -PiTCP -sTCP:LISTEN
npx kill-port 3000 8080 8081
# If still running
sudo killall httpd
sudo launchctl unload /System/Library/LaunchDaemons/org.apache.httpd.plist
@rmsj
rmsj / upper_lower.go
Created September 30, 2021 23:30
[Go Upper or Lower Case] Determine is a string is in lower or upper case in golang #go
func IsUpper(s string) bool {
for _, r := range s {
if !unicode.IsUpper(r) && unicode.IsLetter(r) {
return false
}
}
return true
}
func IsLower(s string) bool {
@rmsj
rmsj / .bash_aliases
Created September 13, 2021 21:53
[Aliases terminal] Cool aliases for terminal #git #terminal
function gito() {
if [ $# -eq 0 ]
then
echo "No arguments supplied"
return 1
fi
git reset --hard && git clean -df && git pull && git checkout $1 && git pull
}
@rmsj
rmsj / Install and uninstall dnsmasq.md
Last active September 27, 2021 02:51
Install and uninstall dnsmasq #Dnsmasq #TipsTricks

Never touch your local /etc/hosts file in OS X again

To setup your computer to work with *.test domains, e.g. project.test, awesome.test and so on, without having to add to your hosts file each time.

Install

brew install dnsmasq

Setup

@rmsj
rmsj / rename-branch-git.md
Last active December 8, 2019 23:23
[Rename branch in GIT] #git

Rename a local and remote branch in git

If you have named a branch incorrectly AND pushed this to the remote repository follow these steps before any other developers get a chance to jump on you and give you shit for not correctly following naming conventions.

  1. Rename your local branch. If you are on the branch you want to rename:

git branch -m new-name

If you are on a different branch:

@rmsj
rmsj / iTerm2 delete settings.txt
Created September 17, 2019 20:49
[iTerm2 Delete Key] Adjusting delete key to iTerm2 on Mac #iTerm2 #Terminal
If you are using zsh, try adding these lines to your ~/.zshrc file, then close and reopen the terminal:
bindkey "^[[3~" delete-char
bindkey "^[3;5~" delete-char
From: https://stackoverflow.com/questions/33270381/delete-forward-character-iterm2-osx
@rmsj
rmsj / docker_auto_complete
Created July 10, 2017 10:19
Docker auto complete on zsh
mkdir ~/.zsh/completion
curl -L https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/plugins/docker/_docker > ~/.zsh/completion/_docker
curl -L https://raw.githubusercontent.com/docker/machine/master/contrib/completion/zsh/_docker-machine > ~/.zsh/completion/_docker-machine
curl -L https://raw.githubusercontent.com/docker/compose/master/contrib/completion/zsh/_docker-compose > ~/.zsh/completion/_docker-compose
Include the directory in your $fpath, e.g. by adding in ~/.zshrc:
fpath=(~/.zsh/completion $fpath)
Make sure compinit is loaded or do it by adding in ~/.zshrc: