Skip to content

Instantly share code, notes, and snippets.

View Ketouem's full-sized avatar

Cyril Thomas Ketouem

View GitHub Profile
@Ketouem
Ketouem / rebaseInitial.sh
Created January 18, 2016 10:09
Rebase from initial commit.
git rebase -i --root $tip
git commit --amend --author "Ketouem <ketouem@gmail.com>"
git rebase --continue
@Ketouem
Ketouem / dockerNuke.sh
Created January 18, 2016 10:08
Clean docker containers and images
# All images
docker rm `docker ps -aq`
docker rmi `docker images -q`
# Only <none>/<none>
docker rmi `docker images | grep '^<none>' | awk '{print $3}'`
@Ketouem
Ketouem / simple_http_server_with_cors.py
Created January 18, 2016 10:06
Provides a (python 2) running instance of SimpleHTTPServer that can handle CORS
#! /usr/bin/env python2
from SimpleHTTPServer import SimpleHTTPRequestHandler
import BaseHTTPServer
class CORSRequestHandler (SimpleHTTPRequestHandler):
def end_headers (self):
self.send_header('Access-Control-Allow-Origin', '*')
SimpleHTTPRequestHandler.end_headers(self)
if __name__ == '__main__':
@Ketouem
Ketouem / renameGitBranch.sh
Created January 18, 2016 10:05
Rename a git branch both locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@Ketouem
Ketouem / updateToMaster.sh
Created January 18, 2016 10:02
Set bluntly a bunch of git repos contained in a folder up to date with the master branch
for file in */ ; do
if [[ -d "$file" && ! -L "$file" ]]; then
echo "$file is a directory, launching git commands.";
cd $file && git checkout master && git reset HEAD --hard && git pull --rebase --prune;
cd ..;
fi;
done