Skip to content

Instantly share code, notes, and snippets.

@radupotop
radupotop / stubby.xml
Created February 18, 2022 10:24 — forked from alanbuxey/stubby.xml
Cloudflare Stubby config
#
# This is a yaml version of the stubby configuration file (it replaces the
# json based stubby.conf file used in earlier versions of getdns/stubby).
#
# For more information see
# https://dnsprivacy.org/wiki/display/DP/Configuring+Stubby
#
# This format does not fully support all yaml features - the restrictions are:
# - the outer-most data structure must be a yaml mapping
# - mapping keys must be yaml scalars
@radupotop
radupotop / build-blog.yml
Last active February 6, 2022 18:50
.github/workflows/build-blog.yml
# .github/workflows/build-blog.yml
#
name: Build & Publish blog
on:
push:
branches: [ master ]
jobs:
build-blog:
@radupotop
radupotop / lsusb-1532-0543.txt
Created November 21, 2021 19:33
lsusb -v -d 1532:0543
Bus 001 Device 004: ID 1532:0543 Razer USA, Ltd Razer Seiren V2 X
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 239 Miscellaneous Device
bDeviceSubClass 2
bDeviceProtocol 1 Interface Association
bMaxPacketSize0 16
idVendor 0x1532 Razer USA, Ltd
@radupotop
radupotop / VersionedMixinModel.py
Last active October 26, 2021 14:04
Django versioned mixin model
class VersionedMixin(Model):
"""
When the model is updated keep the old record intact and create a new one.
"""
parent_revision = ForeignKey('self', on_delete=CASCADE, null=True, blank=True, related_name='+')
child_revision = ForeignKey('self', on_delete=CASCADE, null=True, blank=True, related_name='+')
class Meta:
abstract = True
@radupotop
radupotop / readme.md
Created September 14, 2021 21:43 — forked from mowings/readme.md
ffmpeg stream and save video from Dahua 4300s IP Camera

Use ffmpeg to stream video from a dahua 4300s to a file or files

You can use ffmpeg to directly pull frames off of a dahua 4300s at full resolution. May be a good alternative to pricey dvrs which likely cannot record at full resolution, may not work with the camera, or are prohibitevly expensive

Simple Stream to file

Simple stream to file. Full resolution

ffmpeg -loglevel debug -rtsp_transport tcp -i "rtsp://admin:admin@198.175.207.61:554/live" \

-c copy -map 0 foo.mp4

@radupotop
radupotop / card-offline-outbound.json
Created September 10, 2021 10:15 — forked from billinghamj/card-offline-outbound.json
Monzo transaction types
{
"id": "tx_[transaction-id]",
"created": "2017-07-24T05:45:49.311Z",
"description": "TFL.GOV.UK/CP\\VICTORIA STREET\\TFL TRAVEL CH\\SW1H 0TL GBR",
"amount": -770,
"currency": "GBP",
"merchant": null,
"notes": "",
"metadata": {
"mastercard_clearing_message_id": "mcclearingmsg_[mastercard-clearing-message-id]",
@radupotop
radupotop / filter_model_mixin.py
Created August 24, 2021 20:12 — forked from mlalic/filter_model_mixin.py
A mixin for ``django-rest-framework``providing the possibility to filter the queryset based on query parameters.
from django.db.models import fields as django_fields
class FilteredModelViewSetMixin(object):
"""
A mixin providing the possibility to filter the queryset based on
query parameters.
The mixin overrides the ``get_queryset`` method to return the original
queryset additionally filtered based on the query string parameters.
@radupotop
radupotop / kodi-x11.service
Last active April 9, 2024 09:02
/etc/systemd/system/kodi-x11.service
[Unit]
Description=Kodi standalone (X11)
After=remote-fs.target systemd-user-sessions.service network-online.target nss-lookup.target sound.target bluetooth.target polkit.service upower.service mysqld.service lircd.service
Wants=network-online.target polkit.service upower.service
Conflicts=getty@tty1.service
[Service]
User=kodi
Group=kodi
EnvironmentFile=-/etc/conf.d/kodi-standalone
# /etc/nextdns.conf
#
discovery-dns
auto-activate false
control /run/nextdns/nextdns.sock
config CONFIG_ID
max-ttl 0s
report-client-info true
cache-size 10MB
bogus-priv true
@radupotop
radupotop / foo.py
Created June 29, 2021 14:53 — forked from Grokzen/Symmetrical ManyToMany Filter Horizontal in Django Admin.py
Symmetrical ManyToMany Filter Horizontal in Django Admin
# Based on post from: https://snipt.net/chrisdpratt/symmetrical-manytomany-filter-horizontal-in-django-admin/#L-26
# Only reposting to avoid loosing it.
"""
When adding a many-to-many (m2m) relationship in Django, you can use a nice filter-style multiple select widget to manage entries. However, Django only lets you edit the m2m relationship this way on the forward model. The only built-in method in Django to edit the reverse relationship in the admin is through an InlineModelAdmin.
Below is an example of how to create a filtered multiple select for the reverse relationship, so that editing entries is as easy as in the forward direction.
"""
### pizza/models.py ###