Skip to content

Instantly share code, notes, and snippets.

@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
@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 .