Skip to content

Instantly share code, notes, and snippets.

View dgl's full-sized avatar

David Leadbeater dgl

View GitHub Profile
@dgl
dgl / check-decdhl.sh
Last active June 6, 2025 12:58
Check for DECDHL support (DEC double-height lines)
#!/usr/bin/env bash
# ยฉ David Leadbeater, 2025 <http://ยฉ.st/dgl>
# SPDX-License-Identifier: 0BSD
#
# Detect whether terminals support DECDHL (DEC double-height lines). This is
# not perfect, as terminals are a mess, to put it mildly.
#
# If you want see the output in your terminal, try: curl -i ip.wtf
#
# Usage:
@dgl
dgl / go.mod
Last active May 28, 2025 07:53
ALPN client (openssh s_client but in Go)
module alpnc
go 1.18
@dgl
dgl / waste
Last active March 12, 2024 12:00
https://waste.st (and https://๐Ÿ—‘๏ธ .st) uploader
#!/bin/sh
curl -nT "${1:--}" https://๐Ÿ—‘๏ธ .st
From d2ed74f548fb33029a1d759c328216c5e6f5ff63 Mon Sep 17 00:00:00 2001
From: David Leadbeater <[email protected]>
Date: Wed, 6 Dec 2023 14:17:25 +1100
Subject: [PATCH] confirm-paste: No prompt for whitespace with bracketed paste
Bracketed paste mode means the program is suggesting it can handle
pastes, so just send the data to it if it is on and enabled. The main
downside of this is there's no prompting for large pastes anymore.
There's also a minor security advantage of this -- currently if using
@dgl
dgl / git-osc8-pager
Last active May 17, 2024 10:34
A git pager that wraps less and links commits using OSC8
#!/usr/bin/env perl
# ยฉ2023 David Leadbeater <https://dgl.cx/0bsd>; SPDX-License-Identifier: 0BSD
#
# A git pager that wraps less and links commits, plus makes hiding things via
# backspace not work. Your terminal and less will need support for "OSC8":
# https://github.com/Alhadis/OSC8-Adoption
=pod # Setup; run these commands:
wget https://gist.github.com/dgl/ef848e75c03c09b0db63a43173ee5662/raw/git-osc8-pager &&
@dgl
dgl / add-reminder.html
Created May 3, 2020 17:51
Pushgateway powered reminders!
<!DOCTYPE html>
<script>
const PUSHGATEWAY = 'http://pushgateway:9091';
class Pushgateway {
constructor(baseUrl, instanceLabels) {
this.baseUrl = baseUrl;
this.instanceLabels = instanceLabels;
}
local hipchat = import "hipchat.jsonnet";
local params = hipchat.defaultParameters;
hipchat.notify({}, params + {
APIURL: "http://my.hipchat.local/",
AuthToken: "xxxx==",
RoomID: 42,
from: "alertmanager",
message: "test",
@dgl
dgl / e7.ipynb
Created April 17, 2019 18:37
Google Location History takeout
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dgl
dgl / gist:252dea1f11064bc6d042
Created November 8, 2014 12:41
IRC pipe thing
#!/usr/bin/perl
use strict;
use warnings;
use Getopt::Long;
use Sys::Hostname;
use IO::Async::Loop;
use Net::Async::IRC;
my $nick = hostname . "-$$";
@dgl
dgl / update
Created August 1, 2014 22:21
Additions to zz.countries.nerd.dk.rbldnsd
mkdir -p rsync/dg
rsync -a rsync://countries-ns.mdc.dk/zone/ rsync
cat rsync/zz.countries.nerd.dk.rbldnsd zz.countries.nerd.dk.rbldnsd.add > \
rsync/dg/zz.countries.nerd.dk.rbldnsd