Skip to content

Instantly share code, notes, and snippets.

@jimmydo
jimmydo / ubuntu-server-multicast-dns.md
Last active November 1, 2024 12:37
Enable multicast DNS on Ubuntu Server

Enabling multicast DNS (mDNS) on a server allows other hosts on the local network to address the server as <hostname>.local.

mDNS is disabled by default in Ubuntu Server:

$ resolvectl mdns
Global: no
Link 2 (eno1): no
[Desktop Entry]
Name=vscode-right-click-hotfix
Type=Application
Exec=/usr/bin/env vscode-right-click-hotfix
@campolloram
campolloram / git-pre-commit-hook-django
Last active July 14, 2022 13:05 — forked from mlorant/git-pre-commit-hook-django
Django - Avoid duplicate in migration names before committing changes in Git
#!/usr/bin/python
"""
Pre-commit hook for git written in Python.
Check if there is any migration number used more than one in each
migrations folder of South or Django >= 1.7.
You can install this pre-hook by executing the command:
ln -s ./git-pre-commit-hook .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit
Or by calling the current script or check_migrations_files() in your
own file.
@lrvick
lrvick / github-troll.md
Last active May 3, 2024 16:20
Trolling Github's DMCA repo with their own security flaws.
@Kahtaf
Kahtaf / index.js
Created September 15, 2020 14:37
Create a simple CORS proxy with Cloudflare Workers to bypass CORS restrictions in the browser. Perfect for local development.
/**
* Create a simple CORS proxy with Cloudflare Workers
* to bypass cors restrictions in the browser.
* Example Usage: https://<worker_subdomain>.workers.dev/https://postman-echo.com/get?foo1=bar1&foo2=bar2
*/
addEventListener('fetch', event =>
event.respondWith(handleRequest(event.request))
)
@petedoyle
petedoyle / EdgeToEdge.kt
Last active March 10, 2022 09:59
Kotlin extension functions to simplify edge-to-edge on Android Q
/**
* Applies window transformation flags (WTFs) to aid in supporting
* edge-to-edge layouts on Android Q and higher.
*/
fun Activity?.applyEdgeToEdge(
lightStatusBar: Boolean = false,
lightNavigationBar: Boolean = false,
transparentStatusBar: Boolean = true,
immersive: Boolean = false
) {
@fnky
fnky / ANSI.md
Last active November 17, 2024 08:19
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@h0tw1r3
h0tw1r3 / aria2.daemon
Last active November 5, 2024 17:47
Aria2c systemd service
continue
dir=/var/www/downloads
file-allocation=falloc
max-connection-per-server=4
max-concurrent-downloads=2
max-overall-download-limit=0
min-split-size=25M
rpc-allow-origin-all=true
rpc-secret=YouShouldChangeThis
input-file=/var/tmp/aria2c.session