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
@miguelmota
miguelmota / external_link_arrow.txt
Last active April 30, 2024 15:17
Unicode UTF-8 external link arrow symbol (closest thing to it)
@witmin
witmin / ffmpeg-mp4-to-animated-webp.md
Last active April 20, 2024 23:49
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:

@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
#------------------------------------------------------------------------------
# Notes and references:
CREATE TEXT SEARCH CONFIGURATION fr ( COPY = french );
ALTER TEXT SEARCH CONFIGURATION fr ALTER MAPPING
FOR hword, hword_part, word WITH unaccent, french_stem;
CREATE TEXT SEARCH CONFIGURATION en ( COPY = english );
ALTER TEXT SEARCH CONFIGURATION en ALTER MAPPING
FOR hword, hword_part, word WITH unaccent, english_stem;
CREATE TEXT SEARCH CONFIGURATION de ( COPY = german );
ALTER TEXT SEARCH CONFIGURATION de ALTER MAPPING
@cobusc
cobusc / postgresql_date_function_index_howto.md
Last active March 12, 2024 12:10
Short explanation of the issues faced when trying to create a PostgreSQL index using the date() function and how to resolve it.
@pylover
pylover / a2dp.py
Last active March 11, 2024 03:06
Fixing bluetooth stereo headphone/headset problem in ubuntu 16.04, 16.10 and also debian jessie, with bluez5.
#! /usr/bin/env python3
"""Fixing bluetooth stereo headphone/headset problem in debian distros.
Workaround for bug: https://bugs.launchpad.net/ubuntu/+source/indicator-sound/+bug/1577197
Run it with python3.5 or higher after pairing/connecting the bluetooth stereo headphone.
This will be only fixes the bluez5 problem mentioned above .
Licence: Freeware
@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; }
@jmichalicek
jmichalicek / PrimaryKeyInObjectOutRelatedField.py
Created February 23, 2016 18:19
Django Rest Framework RelatedField allows a PK for input but returns a fully serialized model in response
class PrimaryKeyInObjectOutRelatedField(relations.PrimaryKeyRelatedField):
"""
Django Rest Framework RelatedField which takes the primary key as input to allow setting relations,
but takes an optional `output_serializer_class` parameter, which if specified, will be used to
serialize the data in responses.
Usage:
class MyModelSerializer(serializers.ModelSerializer):
related_model = PrimaryKeyInObjectOutRelatedField(
queryset=MyOtherModel.objects.all(), output_serializer_class=MyOtherModelSerializer)
@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
@raprasad
raprasad / test_unmanaged_models.md
Last active November 1, 2023 00:04
Ignoring migrations during Django testing (unmanaged databases, legacy databases, etc)

Scenario

  • Django 1.9 application with two databases:
    • Legacy database with readonly access via unmanaged models. Both Django models (models.py) 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