Skip to content

Instantly share code, notes, and snippets.

@aroemen
aroemen / postman-rs256-signing.js
Created September 22, 2021 20:43
Postman RS256 JWT Signing
var jwtPrivateKey = `-----BEGIN RSA PRIVATE KEY-----
...
-----END RSA PRIVATE KEY-----`;
// Set headers for JWT
var header = {
'alg': 'RS256',
'typ': 'JWT'
};
git remote add -f Bproject /path/to/B
git merge -s ours --no-commit Bproject/master
git read-tree --prefix=dir-B/ -u Bproject/master
git commit -m "Merge B project as our subdirectory"
git pull -s subtree Bproject master
git clone --bare git@github.com:{USERNAME}/{REPOSITORY_NAME}.git
cd {REPOSITORY_NAME}.git
git push --mirror git@myhost.com:my-new-repo.git
cd ..
rm -rf {REPOSITORY_NAME}.git
@aroemen
aroemen / terminal-load-ssh-key.sh
Created April 19, 2013 13:00
Checks if a SSH key is loaded and loads it if not loaded
# load ssh key
keyloaded=$(ssh-add -l|grep aroemen -c)
if [ $keyloaded == '0' ]
then
ssh-add {path to ssh key}
fi
@aroemen
aroemen / restore-git-submodules.sh
Created February 25, 2013 02:39
Restore git submodules from .gitmodules. Since git submodule init only considers submodules that already are in the index (i.e. "staged") for initialization this short script parses .gitmodules, and each url and path pair.
#!/bin/sh
set -e
git config -f .gitmodules --get-regexp '^submodule\..*\.path$' |
while read path_key path
do
url_key=$(echo $path_key | sed 's/\.path/.url/')
url=$(git config -f .gitmodules --get "$url_key")
git submodule add $url $path
@aroemen
aroemen / git-clean-branches
Created February 12, 2013 16:58
Deletes all local branches that have been merged into HEAD
git branch -d `git branch --merged | grep -v '^*' | tr -d '\n'`
@aroemen
aroemen / ignore-git-line-endings.sh
Created January 9, 2013 18:31
Git ignore line endings on checkout workaround
#!/bin/bash
mv .gitattributes .gitattributes-tmp
git add -u
mv .gitattributes-tmp .gitattributes
git reset .gitattributes
git checkout -- .gitattributes
@aroemen
aroemen / git-change-case.sh
Last active December 10, 2015 12:39
Used to change the case in a directory for a Git repository. Or use this config command `git config core.ignorecase false`
mv foo foo2
git add -A
git commit -m "renaming"
mv foo2 FOO
git add -A
git commit --amend -m "renamed foo to FOO"
# or in git v1.7.7+
git mv improper_Case improve_case2
git mv improper_case2 improve_case