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 April 7, 2024 20:55
Unicode UTF-8 external link arrow symbol (closest thing to it)
@roycewilliams
roycewilliams / pwnedpasswords-v6-top20k.txt
Last active April 1, 2024 18:14
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
#------------------------------------------------------------------------------
@witmin
witmin / ffmpeg-mp4-to-animated-webp.md
Last active April 5, 2024 05:10
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
@bzamecnik
bzamecnik / process_memory_usage_osx.sh
Last active January 24, 2021 15:37
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.
# 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.