Skip to content

Instantly share code, notes, and snippets.

View baseplate-admin's full-sized avatar

baseplate-admin

  • GlitchGalore
  • Middle of Nowhere
View GitHub Profile
@J-Priebe
J-Priebe / jwt_middleware.py
Last active January 17, 2024 15:31
Cookie-based JWT Middleware for Django Channels
from django.contrib.auth.models import AnonymousUser
from django.db import close_old_connections
from django.conf import settings
from channels.sessions import CookieMiddleware
from channels.db import database_sync_to_async
from rest_framework_simplejwt.authentication import JWTAuthentication
import logging
logger = logging.getLogger(__name__)
@wzjoriv
wzjoriv / clustering.py
Last active August 11, 2024 20:47
Nearest Neighbor, K Nearest Neighbor and K Means (NN, KNN, KMeans) implemented only using PyTorch
import torch as th
"""
Author: Josue N Rivera (github.com/wzjoriv)
Date: 7/3/2021
Description: Snippet of various clustering implementations only using PyTorch
Full project repository: https://github.com/wzjoriv/Lign (A graph deep learning framework that works alongside PyTorch)
"""
def random_sample(tensor, k):
@meicookies
meicookies / weeaboo.lol
Created June 21, 2021 20:47
Wibu Stress Generator written in LOLCODE
HAI 1.2
OBTW
CODED BY ./MEICOOKIES
TLDR
O HAI IM WEEB
HOW IZ I SEX YR WAIFU AN YR CUM
CUM, WTF?
OMG "1"
@Guhan-SenSam
Guhan-SenSam / 1info.md
Last active February 24, 2025 23:40
Methods to Optimizing Kivy Performance

Many people state that kivy is slow. While this may be true it is mostly due to that python is slow to run on android devices.Thus it is in the programmer's hands to properly optimize their code so as to create a performant application.

Most of the lag on android devices runing kivy apps arise due to widget creation. Widget creation remains the slowest step in a kivy app. Here are some of the methods that I follow to optimize my apps and ensure I can hit 60fps even on old devices

Optimization Methods:

@JulienPradet
JulienPradet / Component.svelte
Last active February 5, 2025 23:17
How to use `use` directive to trap focus in Svelte
<script>
import {trapFocus} from "./trapFocus";
</script>
<div use:trapFocus>
<button>Hi!</button>
<button>Second button</button>
</div>
@advaith1
advaith1 / top bots.md
Last active April 20, 2025 21:44
The top Discord bots ranked by server count
Rank Bot Approximate Server Count Library
1 MEE6 21,300,000 Custom Python
2 Rythm 🪦 15,200,000 JDA
3 carl-bot 🅱️ 10,900,000 Pycord
4 Groovy 🪦 10,100,000 JDA, Discord4J
5 Dyno
@tomchristie
tomchristie / proxy.py
Created January 15, 2020 13:06
An ASGI proxy service.
import httpx
from starlette.requests import Request
from starlette.responses import StreamingResponse
class Proxy:
def __init__(self, hostname):
self.hostname = hostname
self.client = httpx.AsyncClient()
@tenuki
tenuki / multi_uvicorn.py
Last active February 24, 2024 01:18
How to run multiple uvicorn server apps in the same process (thanks @a-d-j-i )
##
## How to run multiple uvicorn server apps in the same process
##
import asyncio
from uvicorn import Server, Config
class MyServer(Server):
async def run(self, sockets=None):
self.config.setup_event_loop()
return await self.serve(sockets=sockets)
@jpdias
jpdias / RT-N12E-B1.md
Created December 15, 2019 22:06
ASUS RT-N12E-B1

ramips: add support for Asus RT-N11P / RT-N12+ / RT-N12E b1

This is a variant of the MT7620N-based Asus routers.

Specifications:

  • MT7620N (580 MHz)
  • 32 MB RAM
  • 8 MB Flash
  • 5x 10/100Mbps Ethernet (built-in switch)
@eltonvs
eltonvs / arch_installation.md
Last active January 12, 2025 11:21
Arch Linux step to step installation guide

Arch Linux Installation Guide

This guide will show step-by-step how to Install Arch Linux on UEFI mode.

Table of Contents

  • Bootable Flash Drive
  • BIOS
  • Pre installation
    • Set Keyboard Layout
    • Check boot mode
  • Update System Clock