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

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
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
@Guest007
Guest007 / a2dp.py
Created November 9, 2020 09:20 — forked from pylover/a2dp.py
Fixing bluetooth stereo headphone/headset problem in ubuntu 16.04, 16.10 and also debian jessie, with bluez5.
#! /usr/bin/env python3.5
"""
Fixing bluetooth stereo headphone/headset problem in ubuntu 16.04 and also debian jessie, with bluez5.
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 .
@Guest007
Guest007 / donotuse3.py
Created September 25, 2020 09:17 — forked from MineRobber9000/donotuse3.py
How to NEVER use lambdas - Python 3 edition
###########################################################
# How to NEVER use lambdas. An inneficient and yet educa- #
# tonal [sic] guide to the proper misuse of the lambda #
# construct in Python 3.x. [DO NOT USE ANY OF THIS EVER] #
# original by (and apologies to): e000 (13/6/11) #
# now in Python 3 courtesy of: khuxkm (17/9/20) #
###########################################################
## Part 1. Basic LAMBDA Introduction ##
# If you're reading this, you've probably already read e000's