Skip to content

Instantly share code, notes, and snippets.

@douglasmiranda
douglasmiranda / option1.py
Last active May 7, 2021
Fix: Django Debug Toolbar not showing when using with Docker.
View option1.py
# YOU MAY WANT TO CHECK THIS OUT: https://github.com/douglasmiranda/ddpt/blob/master/{{cookiecutter.django_project_name}}/{{cookiecutter.django_project_name}}/config/local.py
# If you don't do this you will have to add the host IP in INTERNAL_IPS = ('127.0.0.1',)
# And it will change, then you will have to change INTERNAL_IPS again.
def show_toolbar(request):
if request.is_ajax():
return False
return True
@juque
juque / MySQL-Chile:regiones-provincias-comunas
Created Jul 6, 2010
Chile: Regiones, Provincias, Comunas
View MySQL-Chile:regiones-provincias-comunas
/* Estructura y Datos de las Regiones, Provincias */
/* y Comunas de Chile. */
/* */
/* Fecha: Julio 2010 */
/* Autor: Juan Pablo Aqueveque - juque.cl */
--
-- Comunas
--
DROP TABLE IF EXISTS `comunas`;
@kidpixo
kidpixo / jupyter_shortcuts.md
Last active May 2, 2021
Keyboard shortcuts for ipython notebook 3.1.0 / jupyter
View jupyter_shortcuts.md

Warning This is SEVERELY outdated, the current jupyter version is > 6.X, please refer to your current jupyter notebook installation!

Disclaimer : I just copied those shortcuts from Jupyter Menú > Help > Keyboard Shortcuts, I didn't wrote them myself.

Check your current shortcuts in your Help, shortcuts coule have been modified by extensions or your past self.

Toc

Keyboard shortcuts

@X-Wei
X-Wei / sliver_appbar_with_tabs.dart
Created Jul 29, 2018
Demo of using SliverAppbar with tabs.
View sliver_appbar_with_tabs.dart
// Sliver appbar with tabs.
// Adapted from: https://stackoverflow.com/a/50858058
import 'package:flutter/material.dart';
void main() => runApp(MaterialApp(
home: SilverAppBarWithTabBarScreen(),
));
class SilverAppBarWithTabBarScreen extends StatefulWidget {
@perrygeo
perrygeo / django_model_graph.sh
Created Apr 13, 2013
Generate UML diagram of django app models
View django_model_graph.sh
apt-get install python-pygraphviz
pip install django-extensions
# add 'django_extensions' to INSTALLED_APPS in settings.py
python manage.py graph_models trees -o test.png
@magopian
magopian / fix_permissions.py
Created Nov 19, 2013
Django admin command to "fix permissions" (create them properly for proxy models). This is needed because of the following bug in Django (not fixed as of 1.6): https://code.djangoproject.com/ticket/11154
View fix_permissions.py
# -*- coding: utf-8 -*-
"""Add permissions for proxy model.
This is needed because of the bug https://code.djangoproject.com/ticket/11154
in Django (as of 1.6, it's not fixed).
When a permission is created for a proxy model, it actually creates if for it's
base model app_label (eg: for "article" instead of "about", for the About proxy
model).
@panchicore
panchicore / bash
Created Oct 7, 2011
solve perl: warning: Setting locale failed.
View bash
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_CTYPE = "UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
@jmcnamara
jmcnamara / bench_excel_writers.py
Last active Dec 11, 2020
Benchmark of several Python Excel writing modules
View bench_excel_writers.py
##############################################################################
#
# Simple Python program to benchmark several Python Excel writing modules.
#
# python bench_excel_writers.py [num_rows] [num_cols]
#
#
import sys
from time import clock
@delameko
delameko / upgrade-postgres-9.5-to-9.6.md
Last active Nov 22, 2020 — forked from johanndt/upgrade-postgres-9.3-to-9.5.md
Upgrading PostgreSQL from 9.5 to 9.6 on Ubuntu 16.04
View upgrade-postgres-9.5-to-9.6.md

TL;DR

Install Postgres 9.6, and then:

sudo pg_dropcluster 9.6 main --stop
sudo pg_upgradecluster 9.5 main
sudo pg_dropcluster 9.5 main
View addsqlite.sh
cordova plugin add https://github.com/brodysoft/Cordova-SQLitePlugin.git