Skip to content

Instantly share code, notes, and snippets.

View raphaelfruneaux's full-sized avatar

Raphael Fruneaux raphaelfruneaux

View GitHub Profile
#!/bin/bash
# Primeiro cria um alias da tag antiga com um nome novo
git tag nome_antigo nome_novo
#
# Remove a tag antiga localmente
git tag -d nome_antigo
#
# Depois, remove a tag no repositório remoto:
# Checkout da fonte remota
git remote -v
@raphaelfruneaux
raphaelfruneaux / models.py
Created April 26, 2017 03:53 — forked from jacobian/models.py
An example of using many-to-many "through" to augment m2m relationships. See http://www.quora.com/How-do-you-query-with-a-condition-on-a-ManyToMany-model-in-Django for context.
from django.db import models
class Person(models.Model):
name = models.CharField(max_length=200)
groups = models.ManyToManyField('Group', through='GroupMember', related_name='people')
class Meta:
ordering = ['name']
def __unicode__(self):
@raphaelfruneaux
raphaelfruneaux / nginx.conf
Created March 28, 2017 13:59 — forked from thoop/nginx.conf
Official prerender.io nginx.conf for nginx
# Change YOUR_TOKEN to your prerender token and uncomment that line if you want to cache urls and view crawl stats
# Change example.com (server_name) to your website url
# Change /path/to/your/root to the correct value
server {
listen 80;
server_name example.com;
root /path/to/your/root;
index index.html;
@raphaelfruneaux
raphaelfruneaux / paises-gentilicos-google-maps.json
Created March 28, 2017 13:00 — forked from jonasruth/paises-gentilicos-google-maps.json
JSON com lista de Países em pt-BR e seus respectivos Gentílicos, Siglas e Nome Internacional - Possui todos os países do Google Maps
[ { "gentilico" : "afegãne",
"nome_pais" : "Afeganistão",
"nome_pais_int" : "Afghanistan",
"sigla" : "AF"
},
{ "gentilico" : "sul-africana",
"nome_pais" : "África do Sul",
"nome_pais_int" : "South Africa",
"sigla" : "ZA"
},
@raphaelfruneaux
raphaelfruneaux / settings.py
Created March 8, 2017 18:10 — forked from kogakure/settings.py
Python: Django Templates: settings.py, local_settings.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os.path
import sys
# Basic Settings
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
PROJECT_NAME = os.path.split(PROJECT_ROOT)[-1]
MEDIA_ROOT = '%s/media/' % PROJECT_ROOT
@raphaelfruneaux
raphaelfruneaux / fix-homebrew-npm.md
Created March 7, 2017 01:57 — forked from DanHerbert/fix-homebrew-npm.md
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

Solution

This solution fixes the error caused by trying to run npm update npm -g. Once you're finished, you also won't need to use sudo to install npm modules globally.

Before you start, make a note of any globally installed npm packages. These instructions will have you remove all of those packages. After you're finished you'll need to re-install them.

@raphaelfruneaux
raphaelfruneaux / middlewares.py
Created September 21, 2016 02:15 — forked from seagatesoft/middlewares.py
An example of RotateUserAgentMiddleware
from random import choice
from scrapy import signals
from scrapy.exceptions import NotConfigured
class RotateUserAgentMiddleware(object):
"""Rotate user-agent for each request."""
def __init__(self, user_agents):
self.enabled = False
self.user_agents = user_agents
@raphaelfruneaux
raphaelfruneaux / range.html
Created August 22, 2016 18:58
Angularjs range filter, n for n in [] | range:0:20
<select name="HH" data-ng-model="" style="width:auto;"
data-ng-options="n for n in [] | range:0:20" required>
<option value="">----</option>
</select>
@raphaelfruneaux
raphaelfruneaux / clear.sh
Last active April 5, 2016 17:42 — forked from wellingtonpgp/clear.sh
Shell script básico de limpeza
#!/bin/bash
# limpeza de arquivos inuteis no sistema
# Criado por Wellington P. Gonçalves (Wellington Geek)
# email: [email protected], [email protected]
# Para executar o script basta localizar a pasta e digitar chmod +x clear.sh
echo "Limpando a lixeira"
sudo rm -rf /home/$USER/.local/share/Trash/files/*
echo ""
@raphaelfruneaux
raphaelfruneaux / gist:be9fd2051b52cdbffcd6
Created December 26, 2015 04:21
Install Scrapy in a recently created Vagrant VM using the box precise32/precise64
sudo apt-get update
sudo apt-get install -y libffi-dev python-dev python-pip libxml2-dev libxslt-dev
sudo pip install Scrapy