Skip to content

Instantly share code, notes, and snippets.

@vstoykov
vstoykov / force_default_language_middleware.py
Last active March 25, 2025 14:26
Force Django to use settings.LANGUAGE_CODE for default language instead of request.META['HTTP_ACCEPT_LANGUAGE']
try:
from django.utils.deprecation import MiddlewareMixin
except ImportError:
MiddlewareMixin = object
class ForceDefaultLanguageMiddleware(MiddlewareMixin):
"""
Ignore Accept-Language HTTP headers
@grenade
grenade / 01-generate-ed25519-ssh-key.sh
Last active July 22, 2025 02:26
generate ed25519 ssh and gpg/pgp keys and set file permissions for ssh keys and config
#!/bin/bash
mkdir -p ~/.ssh
# generate new personal ed25519 ssh keys
ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_ed25519 -C "rob thijssen <[email protected]>"
ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_robtn -C "rob thijssen <[email protected]>"
# generate new host cert authority (host_ca) ed25519 ssh key
# used for signing host keys and creating host certs
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active August 2, 2025 18:01
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@sttwister
sttwister / gist:47e8edff51aaea23e17b
Created November 18, 2014 09:06
Disable crispy-forms automatic field rendering
from django.utils.safestring import mark_safe
from crispy_forms import helper
from crispy_forms.utils import TEMPLATE_PACK, render_field
original_render_layout = helper.FormHelper.render_layout
def new_render_layout(self, form, context, template_pack=TEMPLATE_PACK):
"""
import time
print "..."
time.sleep(1)
print "..."
print "..."
print "..."
print "..."
time.sleep(1)
print "..."
@mrpeardotnet
mrpeardotnet / PVE-HP-ssacli-smart-storage-admin.md
Last active July 28, 2025 11:36
HP Smart Storage Admin CLI (ssacli) installation and usage on Proxmox PVE (6.x)

HP Smart Storage Admin CLI (ssacli) installation and usage on Proxmox PVE (6.x)

Why use HP Smart Storage Admin CLI?

You can use ssacli (smart storage administrator command line interface) tool to manage any of supported HP Smart Array Controllers in your Proxmox host without need to reboot your server to access Smart Storage Administrator in BIOS. That means no host downtime when managing your storage.

CLI is not as convenient as GUI interface provided by BIOS or desktop utilities, but still allows you to fully manage your controller, physical disks and logical drives on the fly with no Proxmox host downtime.

ssacli replaces older hpssacli, but shares the same syntax and adds support for newer servers and controllers.

Installation

@renatoccosta
renatoccosta / install-ha-opi5.adoc
Last active June 26, 2025 08:39
Install Home Assistant on OrangePi 5

Installing Home Assistant on OrangePi 5 Board

This tutorial will enable the use of Home Assistant on an OrangePi 5 board with the following characteristics:

  • OrangePi Debian OS

  • OS running on a SDCard

  • Home Assistant Supervised Instalation

The steps are a compilation with few modifications from instructions found over the web. Links are at the end.

#!/usr/bin/env bash
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
# means.
#
# In jurisdictions that recognize copyright laws, the author or authors