Skip to content

Instantly share code, notes, and snippets.

@Guest007
Guest007 / 90-kensington-expert-trackball-remap.hwdb
Last active May 15, 2024 06:18 — forked from filviu/90-kensington-expert-trackball-remap.hwdb
Remapping Kensington Expert Trackball Buttons with wayland
# Button remap for Kensington Expert Wireless Trackball to:
# BACK MIDDLE
# O
# LEFT RIGHT
# save this file under '/etc/udev/hwdb.d/90-kensington-expert-trackball-remap.hwdb'
# run `sudo systemd-hwdb update` and reboot
#
# source: https://askubuntu.com/questions/1145057/remapping-mouse-buttons-to-keyboard-keys
# and: https://gist.github.com/dnlvgl/d16fd822bc90dcdaaae262a76fad884e
#
@Guest007
Guest007 / far2l-OpenWrt.md
Created April 16, 2023 12:20 — forked from spvkgn/far2l-OpenWrt.md
Build far2l for OpenWrt

Build Far2L using OpenWrt SDK toolchain

  • wget https://downloads.openwrt.org/releases/21.02.3/targets/ramips/mt7621/openwrt-sdk-21.02.3-ramips-mt7621_gcc-8.4.0_musl.Linux-x86_64.tar.xz

  • tar xvf $(ls openwrt-sdk-*.tar.xz) && cd $(ls -d openwrt-sdk-*/) && mkdir -p package/far2l && nano package/far2l/Makefile

include $(TOPDIR)/rules.mk

PKG_NAME:=far2l
# -*- coding: utf-8 -*-
from django.contrib import admin
from django.contrib.admin.options import IncorrectLookupParameters
from django.contrib.admin.views.main import ChangeList
from django.core.cache import cache
from django.core.paginator import Paginator, InvalidPage
from django.db import connection, connections
__all__ = [
'CachingPaginator',

Download Audio from YouTube

-i - ignore errors

-c - continue

-t - use video title as file name

--extract-audio - extract audio track

@Guest007
Guest007 / web-servers.md
Created May 25, 2021 10:26 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
https://github.com/vitalik/django-ninja/issues/15#issuecomment-724286294
import base64
import zlib
def b64_decode(s):
pad = b'=' * (-len(s) % 4)
return base64.urlsafe_b64decode(s + pad)
def decode_session_data(session_data: str):
@Guest007
Guest007 / kivy_asyncio_example.py
Created March 27, 2021 07:16 — forked from dolang/kivy_asyncio_example.py
Kivy with an asyncio EventLoop example
"""
Kivy asyncio example app.
Kivy needs to run on the main thread and its graphical instructions have to be
called from there. But it's still possible to run an asyncio EventLoop, it
just has to happen on its own, separate thread.
Requires Python 3.5+.
"""
@Guest007
Guest007 / django_orm_query_stacktrace.py
Last active March 16, 2021 18:59 — forked from stantonk/django_orm_query_stacktrace.py
Django logging config to dump a stack trace for every ORM query, so you can find the code that is producing queries that are icky.
# add this to your existed Django settings with LOGGING already present
import sqlparse
import logging, inspect
SQL_LOG = os.getenv('SQL_LOG', 'FALSE').strip().upper() == 'TRUE'
SQL_STACKTRACE = os.getenv('SQL_STACKTRACE', 'FALSE').strip().upper() == 'TRUE'
if SQL_LOG:
if 'formatters' not in LOGGING:
LOGGING['formatters'] = {}
@Guest007
Guest007 / 99-noto-mono-color-emoji.conf
Created December 31, 2020 12:19 — forked from IgnoredAmbience/99-noto-mono-color-emoji.conf
Noto Emoji Color fontconfig for Konsole
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!--
Noto Mono + Color Emoji Font Configuration.
Currently the only Terminal Emulator I'm aware that supports colour fonts is Konsole.
Usage:
0. Ensure that the Noto fonts are installed on your machine.
1. Install this file to ~/.config/fontconfig/conf.d/99-noto-mono-color-emoji.conf