Skip to content

Instantly share code, notes, and snippets.

View douglas's full-sized avatar

Douglas Soares de Andrade douglas

View GitHub Profile
@douglas
douglas / gist:1066385
Created July 6, 2011 02:10
Changing git repository without needing to delete and clone the repository
# first see the current origin
git remote -v
# now we delete the origin
git remote rm origin
# now we set the new origin
git remote add origin git@github.com:user/reponame.git
# optional: make git pull and push from someremote (on our case, origin)
@douglas
douglas / gist:1066392
Created July 6, 2011 02:19
Install swig on a archlinux box
sudo pacman -S swig
@douglas
douglas / gist:1072791
Created July 8, 2011 20:52
Remove an unwanted commit on git and github
# force git/github to ignore a unwanted commit and use HEAD^ as HEAD of the repository
$ git push -f origin HEAD^:remote_branch
OR
$ git rebase -i HEAD~2
$ git push origin +master
References:
@douglas
douglas / gist:1072807
Created July 8, 2011 21:00
How to delete a remote branch
$ git push origin :remote_branch_name
@douglas
douglas / gist:1100860
Created July 23, 2011 02:07
Rename (it seems to create a new) branch on github
Execute this command:
$ git push origin remote_branch_name:new_branch_name
Remember that you should edit the repository info to change to the new branch so you can delete the old one with this command:
$ git push origin :old_branch_name
@douglas
douglas / fix_virtualenv
Created October 2, 2015 17:19 — forked from tevino/fix_virtualenv
Fix python virtualenv after python update
#!/usr/bin/env bash
ENV_PATH="$(dirname "$(dirname "$(which pip2)")")"
SYSTEM_VIRTUALENV="$(which -a virtualenv|tail -1)"
echo "Ensure the root of current virtualenv:"
echo " $ENV_PATH"
read -p "‼️ Say no if you are not sure (y/N) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo "♻️ Removing old symbolic links......"
@douglas
douglas / hack.sh
Created April 2, 2012 16:53 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@douglas
douglas / solarized.css
Created April 12, 2012 16:23 — forked from scotu/solarized.css
Solarized Light Pygments CSS
.highlight { background-color: #ffffcc }
.highlight .c { color: #586E75 } /* Comment */
.highlight .err { color: #93A1A1 } /* Error */
.highlight .g { color: #93A1A1 } /* Generic */
.highlight .k { color: #859900 } /* Keyword */
.highlight .l { color: #93A1A1 } /* Literal */
.highlight .n { color: #93A1A1 } /* Name */
.highlight .o { color: #859900 } /* Operator */
.highlight .x { color: #CB4B16 } /* Other */
.highlight .p { color: #93A1A1 } /* Punctuation */
@douglas
douglas / gist:2694967
Created May 14, 2012 16:36
Force a git repo to point to a new HEAD
git push origin HEAD --force
@douglas
douglas / validators.py
Created June 25, 2012 03:49 — forked from dokterbob/validators.py
Validator for files, checking the size, extension and mimetype.
from os.path import splitext
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from django.template.defaultfilters import filesizeformat
class FileValidator(object):
"""
Validator for files, checking the size, extension and mimetype.