Skip to content

Instantly share code, notes, and snippets.

View tie's full-sized avatar
🍔
The devil is in the detail.

Ivan Trubach tie

🍔
The devil is in the detail.
View GitHub Profile
@tie
tie / postgresql-run-as-root.patch
Created July 3, 2024 14:00
PostgreSQL patch to allow running as root user (e.g. in containers).
diff --git a/src/backend/main/main.c b/src/backend/main/main.c
index 51ffb8e773..c92d25c77b 100644
--- a/src/backend/main/main.c
+++ b/src/backend/main/main.c
@@ -49,7 +49,6 @@ static bool reached_main = false;
static void startup_hacks(const char *progname);
static void init_locale(const char *categoryname, int category, const char *locale);
static void help(const char *progname);
-static void check_root(const char *progname);
# This file is a library of Bash functions useful in practice for writing
# reliable scripts.
#
# References:
# • https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html
# These function accept variable names instead of their values to make misuse
# harder. In particular, $(…) expressions do not fail the script even if errexit
# is set. Instead of `printf '{"string":"%s"}' "$(escapeJSONString "$v")", write
# `escapeJSONString v && printf '{"string":"%s"}\n' "$v"` (or equivalent).
@tie
tie / TextReplacement.plugin.js
Last active February 9, 2023 09:11
BetterDiscord plugin that enables auto-correct (text replacements) for message text area
/**
* @name TextReplacement
* @author Ivan Trubach
* @authorId 783087994419675201
* @description Enable autocorrect for messages, specifically text replacements on macOS.
* @version 0.0.4
*/
const memoSymbol = Symbol.for("react.memo")
@tie
tie / crond
Created November 15, 2020 21:08
OpenWrt scheduled update and reboot
0 5 * * * opkg update && opkg list-upgradable | cut -d ' ' -f 0 | xargs -r opkg --autoremove upgrade -- && reboot
@tie
tie / bits.c
Last active December 20, 2019 06:53
All binary strings of length n containing exactly k ones.
/*
// Poor man’s C++ solution.
#include<algorithm>
#include<string>
#include<iostream>
int main() {
int n, k;
std::cin >> n >> k;
@tie
tie / tricks.md
Last active July 27, 2024 10:55
Not so obvious things

Linux things

Fix stupid Docker

Docker daemon messes up iptables configuration.

>/etc/docker/daemon.json cat <<EOF
{
	"iptables": false
@tie
tie / TTGL.svg
Created March 24, 2017 23:31
TOUCH THE UNTOUCHABLE
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.