Skip to content

Instantly share code, notes, and snippets.

@keijiro
keijiro / unity-rust.md
Last active January 24, 2022 09:45
Unity/Rust interoperability test projects
@mikeblum
mikeblum / pi-hole.nomad
Created December 11, 2021 23:45
Pi-hole on Nomad
job "pi-hole" {
datacenters = ["homelab"]
type = "system"
constraint {
attribute = "${attr.kernel.name}"
value = "linux"
}
constraint {
@nateberkopec
nateberkopec / homebridge.hcl
Created March 28, 2021 01:06
Pihole and homekit HCLs for Nomad
job "homebridge" {
datacenters = ["dc1"]
group "server" {
network {
port "http" {
to = 8581
}
}
@picatz
picatz / monitoring.hcl
Created December 12, 2020 19:43
A simple Nomad job file to deploy Prometheus and Grafana
job "metrics" {
datacenters = ["dc1"]
group "prometheus" {
network {
mode = "bridge"
}
service {
name = "prometheus"
@JoeyBurzynski
JoeyBurzynski / 55-bytes-of-css.md
Last active April 10, 2024 20:23
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@adammeghji
adammeghji / gist:5637522
Created May 23, 2013 16:48
Convert a PostgreSQL database from SQL_ASCII to UTF8 encoding
# convert createdb's template to UTF8
echo "UPDATE pg_database SET datistemplate = FALSE WHERE datname = 'template1';" | psql -U postgres
echo "drop database template1;" | psql -U postgres
echo "create database template1 with template = template0 encoding = 'UTF8';" | psql -U postgres
echo "update pg_database set datacl='{=c/postgres,postgres=CTc/postgres}' where datname='template1';" | psql -U postgres
echo "UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template1';" | psql -U postgres
# export and reimport as UTF8
pg_dump -U uniiverse --encoding utf8 mydatabase -f mydatabase_utf8.sql
createdb -U postgres -E utf8 mydatabase_utf8
@josharian
josharian / django_sleep.py
Created December 9, 2011 22:38
Simple Django middleware that delays the processing of each request
"""
This module provides very simple Django middleware that sleeps on every request.
This is useful when you want to simulate slow response times (as might be
encountered, say, on a cell network).
To use, add this middleware, and add a value for SLEEP_TIME to your settings.
Possible future feature: Look for an X-Django-Sleep header on each request,
to let the client specify per-request sleep time.