Skip to content

Instantly share code, notes, and snippets.

Remote Working

Paolo Melchiorre pauloxnet

Remote Working
View GitHub Profile
rajeshr188 /
Last active Jan 26, 2021
Creating ArrayField of custom basefield in Django
from moneyed import Money
from psycopg2.extras import register_composite
from psycopg2.extensions import register_adapter, adapt, AsIs
MoneyValue = register_composite(
View 2a-Leaflet-marker-emoji.html
<!DOCTYPE html>
<html lang="en">
<title>Leaflet - Emoji marker</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="" rel="stylesheet" integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ==" crossorigin=""/>
<script src="" integrity="sha512-gZwIG9x3wUXg2hdXF6+rVkLF/0Vi9U8D2Ntg4Ga5I5BZpVkVxlJWbSQtXPSiUTtC0TjtGOmxa1AJPuV0CPthew==" crossorigin=""></script>
.mymarker { font-size: 50px; }
from django.db import models
from django.db.models import Avg
class Blog(models.Model):
name = models.CharField(max_length=100)
rating = models.DecimalField(max_digits=5, decimal_places=2, null=True)
def __str__(self):
bzamecnik /
Last active Jan 24, 2021
Process memory usage on OSX using GNU time
# On Linux we can use native GNU time, on OSX we have to install gnu-time
# manually, since native time doesn't measure memory.
$ brew install gnu-time
# can be called via gtime, since time is a bash command
# %M - Maximum resident set size of the process during its lifetime, in Kbytes.
apollo13 /
Last active Jun 25, 2017
Django logging to Firefox/Chrome devtools
License: MIT -
ChromeLogger is a protocol which allows sending logging messages to the Browser.
This module implements simple support for Django. It consists of two components:
* `LoggingMiddleware` which is responsible for sending all log messages
associated with the request to the browser.
* `ChromeLoggerHandler` a python logging handler which collects all messages.
lockie /
Last active Jan 14, 2018
A Django migration to add PostgreSQL trigram search, aka pg_trgm
# -*- coding: utf-8 -*-
# XXX this is actually useful for very special use cases, e.g. misspel suggestions:
from __future__ import unicode_literals
from django.db import migrations
from django.contrib.postgres.operations import TrigramExtension
class Migration(migrations.Migration):
operations = [
pylover /
Last active Feb 9, 2021
Fixing bluetooth stereo headphone/headset problem in ubuntu 16.04, 16.10 and also debian jessie, with bluez5.
#! /usr/bin/env python3.5
Fixing bluetooth stereo headphone/headset problem in ubuntu 16.04 and also debian jessie, with bluez5.
Workaround for bug:
Run it with python3.5 or higher after pairing/connecting the bluetooth stereo headphone.
This will be only fixes the bluez5 problem mentioned above .
raprasad /
Last active Feb 25, 2021
Ignoring migrations during Django testing (unmanaged databases, legacy databases, etc)


  • Django 1.9 application with two databases:
    • Legacy database with readonly access via unmanaged models. Both Django models ( and related migrations have "managed" set to False
      • 'managed': False
    • Default database holding django specific tables (e.g. auth_user, django_content_type, etc)

Testing Woes

pauloxnet /
Last active Apr 1, 2016 — forked from jefftriplett/
Django management command to trace / list all signals. My fork is just a few cleanups where CommandError wasn't referenced, etc.
# coding:utf-8
import gc
import inspect
import weakref
from import BaseCommand, CommandError
from django.dispatch import Signal
from django.dispatch.weakref_backports import WeakMethod
from optparse import make_option