Skip to content

Instantly share code, notes, and snippets.

@bahadiraraz
bahadiraraz / Git_Commit_Freeze_Solution.md
Last active April 18, 2025 15:06
Git Commit Freeze Due to GPG Lock Issues (Solution)

Git Commit Freeze Due to GPG Lock Issues

If you encounter a problem where you cannot commit changes in Git – neither through the terminal nor via the GitHub Desktop application – the issue might be a freeze during the Git commit process. This is often caused by GPG lock issues. Below is a concise and step-by-step guide to resolve this problem.

Solution Steps

1. Check for GPG Lock Messages

Open your terminal and try to perform a GPG operation (like signing a test message). If you see repeated messages like gpg: waiting for lock (held by [process_id]) ..., it indicates a lock issue.

@nielsvanvelzen
nielsvanvelzen / jf-dev-auth.md
Last active April 3, 2025 04:19
Jellyfin API Authorization

Jellyfin API Authorization

To start using the Jellyfin API, authorization is probably the first thing you'll need to do. Jellyfin's authorization options can be a bit confusing because there are a lot of deprecated options.

Generally there are three ways to authenticate: no authorization, user authorization with an access token or authorization with an API key. The first way is easy, just do nothing. But most often you'll need to use either the access token or API key.

Sending authorization values

There are multiple methods for transmitting authorization values, however, some are outdated and scheduled to be removed. It's recommend to use the Authorization header. If header auth isn't an option, the token may be sent through the ApiKey query parameter. Sending secure data in a query parameter is unsafe as the changes of it leaking (via logs, copy-paste actions or by other means) are high. Only use this method as a last resort.

@tcely
tcely / Social_Media.md
Created December 18, 2022 23:04
Social Media Information
@JulyIghor
JulyIghor / firetv_firmware.md
Last active April 17, 2025 04:37
Amazon Fire TV Stick 4K Firmware and apps. Official Cloud Front direct links only
@jeb5
jeb5 / Youtube Subs to OPML.js
Last active November 9, 2024 02:13
Youtube Subscriptions to RSS/OPML
const channels = [...document.querySelectorAll("#main-link.channel-link")].map(e => {
const [, a, b] = e.href.match("/((?:user)|(?:channel))/(.*)$");
const feed = "https://www.youtube.com/feeds/videos.xml?" + (a === "user" ? "user=" : "channel_id=") + b;
const channelName = e.querySelector("yt-formatted-string.ytd-channel-name").innerText;
return [feed, channelName];
});
if (channels.length == 0) {
alert("Couldn't find any subscriptions");
} else {
console.log(channels.map(([feed, _]) => feed).join("\n"));
@rrei
rrei / example.py
Last active April 12, 2025 18:33
Different attempts at solving memory usage problems caused by large Django querysets
def do_stuff(obj):
"""Performs some simple processing on `obj`."""
obj.y = obj.related_obj.x ** 2 + 1 # DB query to fetch `.related_obj`
obj.save() # DB query to update `obj`
# Obtain a large queryset for this example.
qs = MyFurstModel.objects.all()
# Attempt no. 1: NO GOOD. This direct/naive approach has the advantage of describing
@rrei
rrei / chunked_qs.py
Created July 29, 2020 08:40
Break a large Django queryset into an equivalent set of smaller querysets (caveats apply)
def chunked_queryset(queryset, chunk_size=10000):
"""Slice a queryset into chunks. This is useful to avoid memory issues when
iterating through large querysets.
Code adapted from https://djangosnippets.org/snippets/10599/
"""
if not queryset.exists():
return
queryset = queryset.order_by("pk")
pks = queryset.values_list("pk", flat=True)
@rrei
rrei / settings.py
Created December 26, 2018 11:41
Django settings for reverse-proxy scenarios
USE_X_FORWARDED_HOST = True
USE_X_FORWARDED_PORT = True
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
@rrei
rrei / proxy-headers.conf
Last active April 12, 2025 18:35
Nginx proxy headers
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # allows django to get the client's IP address (see the ipware module)
proxy_set_header X-Forwarded-Proto $scheme; # allows django to determine that the request is secure (see SECURE_PROXY_SSL_HEADER and request.is_secure())
proxy_set_header X-Forwarded-Host $host; # allows django to determine the name/addr of the server that the client originally connected to (see request.get_host())
proxy_set_header X-Forwarded-Port $server_port; # same idea as above, but for port number (see request.get_port())
@joemaller
joemaller / Verizon FiOS - DNS servers.md
Created May 9, 2018 14:49
Nameservers for Verizon FiOS - North East US specific

Boston, MA:

  • nsbost02.verizon.net - 71.243.0.14

New York, NY:

  • nsnyny02.verizon.net - 68.237.161.14

Newark, NJ:

nsnwrk02.verizon.net - 71.250.0.14

Philadelphia, PA: