Skip to content

Instantly share code, notes, and snippets.

View dgl's full-sized avatar

David Leadbeater dgl

View GitHub Profile
@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 / 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 <dgl@dgl.cx>
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 / 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 / search_cpan.pl
Created October 11, 2011 19:45
acme's search_cpan.pl with threads
#!/usr/bin/perl
use strict;
use threads;
use threads::shared;
use warnings;
use 5.12.0;
use Archive::Peek::Libarchive;
use Parse::CPAN::Packages;
use Path::Class;
use Term::ANSIColor;
package a;
sub foo {
warn "foo";
}
sub rebind {
no warnings "redefine";
eval q{delete $a::{foo}};
eval q{*foo = sub { warn "bar" }};
package Aaaaaaaa::Test;
use Test::More ();
sub import {
local $_[0] = "Test::More";
goto \&{Test::More->can("import")};
}
1;
@dgl
dgl / installblead
Created January 23, 2011 16:52
An install script that installs a development version of perl (from git) and keeps a particular set of modules installed. Sort of perlbrew for blead, but not quite.
#!/bin/sh
# installblead: An install script that installs a development version of perl
# (from git) and keeps a particular set of modules installed. Sort of perlbrew
# for blead, but not quite.
# Usage:
# wget -O ~/bin/installblead https://gist.github.com/raw/792206/installblead
# chmod +x ~/bin/installblead
#
# git clone git://perl5.git.perl.org/perl # or git pull, whatever