Skip to content

Instantly share code, notes, and snippets.

View pauloxnet's full-sized avatar
🐍
https://www.paulox.net

Paolo Melchiorre pauloxnet

🐍
https://www.paulox.net
View GitHub Profile
@jorritfolmer
jorritfolmer / pelican-tailwind-css.md
Last active November 29, 2023 06:59
Pelican with Tailwind CSS

How to use Tailwind CSS with Pelican

These steps show how to install Tailwind CSS in a Pelican project, purge and minify it so you don't have to reference a 3+ MB CSS file but only several kB.

  1. virtualenv venv
  2. . venv/bin/activate
  3. pip install nodeenv
  4. nodeenv env
  5. . env/bin/activate
  6. npm install postcss postcss-cli autoprefixer tailwindcss purgecss cssnano
@rajeshr188
rajeshr188 / models.py
Last active January 26, 2021 10:21
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(
'money_value',
connection.cursor().cursor,
globally=True
).type
@miguelmota
miguelmota / external_link_arrow.txt
Last active July 25, 2024 17:02
Unicode UTF-8 external link arrow symbol (closest thing to it)
@tiran
tiran / python-on-debian.md
Last active May 21, 2024 08:46
Negative Python user experience on Debian/Ubuntu

Negative Python user experience on Debian/Ubuntu

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.

Reproducer

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.

Run Debian container

@roycewilliams
roycewilliams / pwnedpasswords-v6-top20k.txt
Last active July 13, 2024 06:16
pwnedpasswords-v6-top20k.txt
This file has been truncated, but you can view the full file.
#------------------------------------------------------------------------------
# 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
#------------------------------------------------------------------------------
# Notes and references:
@witmin
witmin / ffmpeg-mp4-to-animated-webp.md
Last active July 11, 2024 01:36
Convert MP4 file to animated WebP in ffmpeg

Convert MP4 file to animated WEBP file in ffmpeg CLI

1. Install ffmpeg CLI through homebrew

In terminal.app, install ffmpeg through homebrew

brew install ffmpeg

Validate the installation:

@RikdeBoer
RikdeBoer / 2a-Leaflet-marker-emoji.html
Created December 21, 2019 03:44
Leaflet emoji marker
<!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; }
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
@marcgibbons
marcgibbons / concat_json_expression.py
Last active September 12, 2023 19:05
Expression to concatenate Django Postgres JSONField
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())
)
import pandas as pd
import numpy as np