Skip to content

Instantly share code, notes, and snippets.

@lzjluzijie
lzjluzijie / warp.js
Created February 25, 2024 07:55
Cloudflare Warp 24PB key generator
# See https://halu.lu/%E6%9D%82%E8%B0%88/cloudflare-warp/
# Depolyed at https://warp.halu.lu/
// Change keys if needed
const keys = [
"9WO41D5p-6OP8xj27-36gQG75D",
"R65K12Up-aU907O2e-4nuvD581",
"06LM94EJ-1nl0V2d7-V847va5y",
]
@AllanChain
AllanChain / netease_music_dl.py
Created June 29, 2021 03:37
网易云音乐歌单下载,保留 ID3 属性
from bs4 import BeautifulSoup
from pathlib import Path
from dataclasses import dataclass
import urllib.request
import re
from unicodedata import normalize
from mutagen.mp3 import EasyMP3
DOWNLOAD_TEMPLATE = "http://music.163.com/song/media/outer/url?id=%s.mp3"
"""A set of helpers for reversing urls, similar to Django ``reverse``.
Usage:
.. code:: python
@router.get("/class/{class_id}")
async def get_class(request: Request, class_id: int = Path(...)):
student_route = get_route(request.app, "list_students")
class_students_url = URLFactory(student_route).get_path(class_id=class_id)
@danizen
danizen / middleware.py
Last active December 11, 2023 07:59
Django middleware to collect slow queries using force_debug_cursor
import logging
import time
from django.conf import settings
from django.db import connection
THRESHOLD = getattr(settings, 'SLOW_REQUEST_THRESHOLD', 1.0)
LOG_SQL = getattr(settings, 'SLOW_REQUEST_LOG_SQL', False)
LOG = logging.getLogger(__name__)
@ukn
ukn / 99-install-facetime-camera.sh
Last active May 5, 2024 20:47 — forked from Stono/99-install-facetime-camera.sh
Install the kernal module required for the facetimehd camera to work on Linux
#!/bin/bash
set -e
export CONFIG_MODULE_SIG=n
export CONFIG_MODULE_SIG_ALL=n
# For current kernel
export KERNELRELEASE=$(cat /proc/version | awk '{print $3}')
temp_dir=$(mktemp -d)
echo "Installing FacetimeHD camera for $KERNELRELEASE"
@Greelan
Greelan / letsencrypt_notes.sh
Last active March 11, 2024 12:39 — forked from lachesis/letsencrypt_notes.sh
Set up Let’s Encrypt certificate using acme.sh as non-root user
# How to use acme.sh to set up Let's Encrypt, with the script being run
# mostly without root permissions
# See https://github.com/Neilpang/acme.sh for more
# These instructions use the domain "EXAMPLE.COM" as an example
# These instructions:
# - work on Ubuntu 18.04 and 20.04 with nginx
# - use CloudFlare DNS validation
@bucho666
bucho666 / class.nim
Last active March 10, 2024 15:44
nim class macro
import macros
proc typeName(head: NimNode): NimNode =
if head.len == 0: head else: head[1]
proc baseName(head: NimNode): NimNode =
if head.len == 0: newIdentNode("RootObj") else: head[2]
proc isObjectDef(head: NimNode): bool =
head.len == 0 or head[2].kind == nnkIdent
@atomize
atomize / _get.sh
Created February 26, 2019 22:03
bash function to download file from web without cURL/wget
# Add this to your .bashrc
# Use it like: you@console_>$ _get https://website.org/file.txt
_get ()
{
IFS=/ read proto z host query <<< "$1"
exec 3< /dev/tcp/$host/80
{
echo GET /$query HTTP/1.1
echo connection: close
echo host: $host
@natevw
natevw / gboard_morse.md
Last active March 26, 2024 09:51
A list of Morse code supported by GBoard Android Keyboard

Morse code supported by GBoard Android Keyboard

Google's GBoard software keyboard has a Morse code mode.

Here's what characters it currently supports:

  • .-a
  • -...b
  • -.-.c
  • -..d
@ferment
ferment / ldmacclientuninstall.sh
Created November 6, 2017 01:24
Remove LANDESK from OSX / macOS
#!/bin/sh
#
function killAllProcs( )
{
sudo /usr/bin/killall $1
/bin/ps ax | /usr/bin/grep $1|/usr/bin/awk '{print $1}'|/usr/bin/xargs sudo kill -9
}
echo "removing LANDesk Client"