Skip to content

Instantly share code, notes, and snippets.

View gollum23's full-sized avatar
:octocat:
Learning all days

Diego Forero gollum23

:octocat:
Learning all days
View GitHub Profile
Esta son aplicaciones de django muy utiles, para como dice la filosofia de Instagram no reinventar la rueda :).
django-mingus
django-ratings
django-ajax-validation
django-google-analytics

Set up Django, nginx and uwsgi

Steps with explanations to set up a server using:

  • virtualenv
  • Django
  • nginx
  • uwsgi
# Create sudo user
adduser <user>
usermod -a -G sudo <user>
logout
# Update and clean
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get autoremove
@gollum23
gollum23 / patch.py
Last active August 29, 2015 14:10 — forked from dequis/patch.py
#!/usr/bin/env python
"""
MSN ApplicationId patcher for pidgin/bitlbee/whatever
(because you're too lazy to rebuild the whole thing.)
Usage examples:
python patch.py /usr/sbin/bitlbee
python patch.py /usr/lib/purple-2/libmsn.so
@gollum23
gollum23 / .gitconfig
Last active August 29, 2015 14:14 — forked from pksunkara/config
[user]
name = Pavan Kumar Sunkara
email = pavan.sss1991@gmail.com
[core]
editor = vim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
excludesfile = ~/.gitignore
[sendemail]
smtpencryption = tls
smtpserver = smtp.gmail.com
"""
Two things are wrong with Django's default `SECRET_KEY` system:
1. It is not random but pseudo-random
2. It saves and displays the SECRET_KEY in `settings.py`
This snippet
1. uses `SystemRandom()` instead to generate a random key
2. saves a local `secret.txt`
# -*- encoding: utf-8 -*-
######################################################################################################
## ##
## SCRIPT EN PYTHON PARA EL RESPALDO DE BASES DE DATOS POSTGRES ##
## ##
## Almacenará tres tipos de copia: ##
## - Diarias: el sistema realizará una copia diaria por base de datos y eliminará aquellas ##
## que tengan más de N_DAYS_AGO_DIARY_BACKUP días de antiguedad ##
## - Semanales: el sistema realizará una copia semanal cada viernes de cada base de datos y ##
@gollum23
gollum23 / copy_registers
Last active September 13, 2015 02:30 — forked from rg3915/copy_registers
Copiar registros de tabela OneToMany
from vendas_project.vendas.models import Sale, SaleDetail
s = Sale.objects.filter(pk=1) # filtra a Venda pelo pk
d = SaleDetail.objects.filter(sale=s) # filtra os itens dessa Venda
s = Sale.objects.get(pk=s) # com o get pega o pk da Venda que foi filtrada
s.pk = None
s.save() # salva uma cópia da Venda
for i in d:
n = SaleDetail.objects.create(
sale=s, product=i.product, quantity=i.quantity, price_sale=i.price_sale, subtotal=i.quantity * i.price_sale)
@gollum23
gollum23 / jupyter_shortcuts.md
Created November 8, 2016 22:19 — forked from kidpixo/jupyter_shortcuts.md
Keyboard shortcuts for ipython notebook 3.1.0 / jupyter

Toc

Keyboard shortcuts

The IPython Notebook has two different keyboard input modes. Edit mode allows you to type code/text into a cell and is indicated by a green cell border. Command mode binds the keyboard to notebook level actions and is indicated by a grey cell border.

MacOS modifier keys:

  • ⌘ : Command
@gollum23
gollum23 / index.html
Created January 23, 2017 01:44 — forked from CodeMyUI/index.html
Pokemon Slider
<div class="slider__warpper">
<div class="flex__container flex--pikachu flex--active" data-slide="1">
<div class="flex__item flex__item--left">
<div class="flex__content">
<p class="text--sub">Pokemon Gen I</p>
<h1 class="text--big">Pikachu</h1>
<p class="text--normal">Pikachu is an Electric-type Pokémon introduced in Generation I. Pikachu are small, chubby, and incredibly cute mouse-like Pokémon. They are almost completely covered by yellow fur.</p>
</div>
<p class="text__background">Pikachu</p>
</div>