Skip to content

Instantly share code, notes, and snippets.

View leonadler's full-sized avatar

Leon Adler leonadler

View GitHub Profile
@leonadler
leonadler / settings.json
Created March 5, 2026 18:30 — forked from rpavlik/settings.json
Go away copilot and other slop machines (in vscode)
{
// go away copilot and other ai slop machines
"accessibility.verboseChatProgressUpdates": false,
"accessibility.verbosity.inlineChat": false,
"accessibility.verbosity.panelChat": false,
"accessibility.verbosity.terminalChatOutput": false,
"ansible.lightspeed.suggestions.waitWindow": 360000,
"chat.agent.codeBlockProgress": false,
"chat.agent.enabled": false,
"chat.agent.maxRequests": 0,
@leonadler
leonadler / keybindings.pl
Created January 12, 2026 03:20 — forked from elgalu/keybindings.pl
Export Ubuntu shortcuts: keybindings.pl -e keys.csv ;; Import (DANGER) Ubuntu shortcuts: keybindings.pl -i keys.csv
#!/usr/bin/perl
use strict;
my $action = '';
my $filename = '-';
for my $arg (@ARGV){
if ($arg eq "-e" or $arg eq "--export"){
$action = 'export';
@leonadler
leonadler / Tmux JSON format.md
Last active November 18, 2025 05:00
Tmux JSON format

Tmux JSON formatter

Because when all you have is a JSON hammer, everything looks like a JSON nail.

How to use

$ json=$(tmux display-message -p $(<tmux-json-format.txt));
$ your-program-that-needs-json <<<"$json"
@leonadler
leonadler / Setting up Postfix on Debian.md
Created September 6, 2025 08:56 — forked from howyay/Setting up Postfix on Debian.md
A guide to set up a Postfix + Dovecot IMAP server with complete spf, dkim and dmarc support.

An ultimate guide to Postfix + Dovecot IMAP server with complete SPF, DKIM and DMARC support and additional instructions for a multi-domain setup

In this guide, domain.com will be your root domain and mail.domain.com will be the hostname of your mail server

@leonadler
leonadler / ANSI.md
Created November 30, 2023 18:14 — forked from fnky/ANSI.md
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@leonadler
leonadler / useIsInStrictMode.test.tsx
Last active November 15, 2023 04:40
Detect React StrictMode
import { useIsInStrictMode } from './useIsInStrictMode';
test('detect strict mode', async () => {
function TestComponent() {
const [isInStrictMode, CheckStrictMode] = useIsInStrictMode();
return (
<p>
<CheckStrictMode />
{`Strict mode: ${isInStrictMode ? 'on' : 'off'}`}
@leonadler
leonadler / overlayColors.js
Last active June 9, 2022 17:02
Helper to test how the browser blends overlayed semi-transparent colors
/**
* Helper to test how alpha-transparent colors are layered in the browser.
*
* @example
* blendColors('255 0 0 / 20%', '60 60 40 / 30%', '128 96 44 / 60%')
* // -> {r: 128, g: 84, b: 40, a: 0.7764705882352941}
*/
function overlayColors(...colors) {
let canvas;
if (typeof OffscreenCanvas === 'function') {
@leonadler
leonadler / useMemoizedCallback.tsx
Last active October 20, 2021 09:02 — forked from Alx-l/index.tsx
React useMemoizedCallback hook
import * as React from "react";
// see: https://stackoverflow.com/questions/55045566/react-hooks-usecallback-causes-child-to-re-render/55047178
/**
* Useful when you when to pass a function that depends on a piece of state,
* as a prop, without triggering a re-render everytime.
*
* @example
*
@leonadler
leonadler / hasEnabledAdblock.js
Last active March 1, 2021 12:42
Detect if an ad blocker is enabled for the current page
function checkAdblockerEnabled() {
const div = document.createElement('div');
div.className = 'ad_container';
const style = document.createElement('style');
style.innerText = `.ad_container { width:500px; }`;
document.head.appendChild(style);
document.body.appendChild(div);
const hasAdblock = div.offsetWidth < 500;
document.head.removeChild(style);
document.body.removeChild(div);
@leonadler
leonadler / svg2ico.sh
Created December 1, 2020 14:49 — forked from azam/svg2ico.sh
Convert SVG to ICO using ImageMagick, with transparent background and multi-size icons
convert -density 256x256 -background transparent favicon.svg -define icon:auto-resize -colors 256 favicon.ico