Skip to content

Instantly share code, notes, and snippets.

View rnegron's full-sized avatar

Raúl Negrón rnegron

View GitHub Profile
@rnegron
rnegron / migrations.md
Created August 24, 2020 19:22 — forked from majackson/migrations.md
Django migrations without downtime

Django Migrations without Downtime

The following instructions describe a set of processes allowing you to run Django database migrations against a production database without having to bring the web service down.

Note that in the below instructions, migrations are all run manually at explicit points, and are not an automatic part of the deployment process.

Adding Fields or Tables

Adding a (nullable) field or a new table

  1. Make the model or column addition in your code.
[
{
"municipality": "adjuntas",
"adjacent": [
"guayanilla",
"lares",
"pe\u00f1uelas",
"ponce",
"utuado",
"yauco"
@rnegron
rnegron / metacritic_top_100_games.py
Last active September 17, 2017 16:51
Short Python script for parsing, numbering and printing the top 100 video games according to metacritic.com
import requests, re
from bs4 import BeautifulSoup as BS
META_URL = 'http://www.metacritic.com/browse/games/score/metascore/all/all/filtered?sort=des'
HEADERS = {'user-agent': 'Mozilla/5.0'}
r = requests.get(META_URL, headers=HEADERS)
soup = BS(r.text, 'html.parser')
@rnegron
rnegron / endi_shorten.py
Last active June 16, 2017 22:44
Practicing strings and generally de-rusting Python...
# !/usr/bin/env python
from sys import argv
import string
import random
def main():
if len(argv) < 2 or len(argv) > 3:
return 'Usage: $ python {script} url opt-div\n'.format(script=argv[0])