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)
@chrismytton
chrismytton / net.hecticjeff.firewall.plist
Created January 19, 2012 19:03
Firewall rule to proxy requests on port 80 to nginx on port 8080
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>net.hecticjeff.firewall</string>
<key>ProgramArguments</key>
<array>
<string>sh</string>
<string>-c</string>
function pless {
pygmentize -O encoding=UTF-8 $1 | less -r
}
@clarkware
clarkware / lyrics.rb
Created September 10, 2012 20:05
Random Lyrics
#!/usr/bin/env ruby
# API Documentation at http://api.wikia.com/wiki/LyricWiki_API
require 'open-uri'
require 'json'
require 'tmpdir'
ARTIST = "Johnny Cash"
@westurner
westurner / setup_pandas_notebook.sh
Created July 29, 2012 07:53
Setup IPython Notebook and Pandas for OSX
#!/bin/sh
setup_brew () {
if ![-f "/usr/local/bin/brew"]; then
/usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"
fi
}
setup_ipython () {
brew install readline
@KirstensAmazing
KirstensAmazing / LogGelf
Created July 24, 2012 22:27
logstash GELF filtering
filter {
## This will pull out unnecessary and repeated celery information about it starting jobs. This goes first so that it doesn't get mutated later.
grep {
type => "celeryd"
match => ["@message", "^([D|d]ebug|DEBUG|[N|n]otice|NOTICE|[I|i]nfo|INFO|[W|w]arn?(?:ing)?|WARN?(?:ING)?|[E|e]rr?(?:or)?|ERR?(?:OR)?|[C|c]rit?(?:ical)?|CRIT?(?:ICAL)?) [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2},[0-9]{3} .*?$"]
negate => true
}
## This will capture the message in the format time: severity/process message . This is capturing the data and tagging it so that it can be exported to our GELF format later
grok {
match => ["@message", "\[%{DATESTAMP:timestamp}: %{DATA:severity}/%{DATA:process}\] %{DATA:message}$"]
@tapajos
tapajos / gist:3014438
Created June 28, 2012 22:42
project_update
#!/bin/bash
cd ~/workspace
echo -e "\n\033[1mPulling all repositories...\033[0m\n"
for i in $(find . -maxdepth 1 -mindepth 1 -type d -type d); do
echo -e "\033[1m"+$i+"\033[0m"; cd $i; git pull --rebase;
cd ..
done
@eliotsykes
eliotsykes / camfix .bashrc
Last active August 1, 2021 02:06
camfix - Terminal command to fix Mac OS X built-in webcam
#!/bin/bash
# Add to your .bashrc on Mac OSX, then run camfix in Terminal
# if the Mac's built-in camera stops working.
# Thanks to: http://osxdaily.com/2013/12/27/fix-there-is-no-connected-camera-error-mac/
alias camfix='sudo killall VDCAssistant; sudo killall AppleCameraAssistant'
@myobie
myobie / mountain-lion-brew-setup.markdown
Created February 18, 2012 20:14
Get Mountain Lion and Homebrew to Be Happy

Get Mountain Lion and Homebrew to Be Happy

1) Install XCode 4.4 into /Applications

Get it from the App Store.

2) Install Command Line Tools

In XCode's Preferences > Downloads you can install command line tools.

@dokterbob
dokterbob / validators.py
Created August 31, 2011 15:03
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.