import pandas as pd
import numpy as np
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # On Linux we can use native GNU time, on OSX we have to install gnu-time | |
| # manually, since native time doesn't measure memory. | |
| # http://man7.org/linux/man-pages/man1/time.1.html | |
| # http://braumeister.org/formula/gnu-time | |
| $ 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.db.models.expressions import CombinedExpression, F, Value | |
| from django.contrib.postgres.fields import JSONField | |
| expression = CombinedExpression( | |
| F('my_json_field'), | |
| '||', | |
| Value({'fizz': 'buzz'}, JSONField()) | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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): | |
| return self.name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <title>Leaflet - Emoji marker</title> | |
| <meta charset="utf-8" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <link href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css" rel="stylesheet" integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ==" crossorigin=""/> | |
| <script src="https://unpkg.com/leaflet@1.6.0/dist/leaflet.js" integrity="sha512-gZwIG9x3wUXg2hdXF6+rVkLF/0Vi9U8D2Ntg4Ga5I5BZpVkVxlJWbSQtXPSiUTtC0TjtGOmxa1AJPuV0CPthew==" crossorigin=""></script> | |
| <style> | |
| .mymarker { font-size: 50px; } |
This file has been truncated, but you can view the full file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #------------------------------------------------------------------------------ | |
| # Top 20K hashes from the Troy Hunt / haveibeenpwned Pwned Passwords list v6 (2020-06-19) | |
| # with frequency count and cracked plaintext passwords | |
| # | |
| # The latest version of this file can be found here: | |
| # https://gist.github.com/roycewilliams/226886fd01572964e1431ac8afc999ce | |
| # The equivalent of this file, but based on v2 of the Pwned Passwords, is here: | |
| # https://gist.github.com/roycewilliams/281ce539915a947a23db17137d91aeb7 | |
| #------------------------------------------------------------------------------ |
The user experience of Python on a minimal Debian or Ubuntu installation is bad. Core features like virtual environments, pip bootstrapping, and the ssl module are either missing or do not work like designed and documented. Some Python core developers including me are worried and consider Debian/Ubuntu's packaging harmful for Python's reputation and branding. Users don't get what they expect.
The problems can be easily reproduced with official Debian and Ubuntu containers in Docker or Podman. Debian Stable (Debian 10 Buster) comes with Python 3.7.3. Ubuntu Focal (20.04 LTS) has Python 3.8.5.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ↗ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from moneyed import Money | |
| from psycopg2.extras import register_composite | |
| from psycopg2.extensions import register_adapter, adapt, AsIs | |
| MoneyValue = register_composite( | |
| 'money_value', | |
| connection.cursor().cursor, | |
| globally=True | |
| ).type |
