Skip to content

Instantly share code, notes, and snippets.

View DeeNewcum's full-sized avatar

Dee Newcum DeeNewcum

View GitHub Profile
@DeeNewcum
DeeNewcum / snippets.pl
Last active November 9, 2023 20:49
Perl snippets that I sometimes copy-and-paste
# These are minified versions of Perl routines, intended to be easy to copy-n-paste into Perl scripts.
# http://en.wikipedia.org/wiki/Minification_(programming)
#
# I acknowledge that these go against numerous coding principles:
# - DRY
# - compactness hinders readability and maintainability
# - using cut-n-paste instead of libraries means that bugs will stick around longer because bugfixes
# are MUCH harder to distribute
# - this code is tested by only one person, and so is far less mature than CPAN code
# But there's one upside to copy-n-pasting minified functions:
@DeeNewcum
DeeNewcum / single_step.sh
Last active November 2, 2022 16:17
a template for making single-step deployment scripts
#!/bin/bash
######## begin single-step debugging mechanism ########
DEBUG_COLOR_ONE="\e[47;30m" # gray background, black foreground
DEBUG_COLOR_TWO="\e[0;1;31m" # black background, bright red foreground
function _trap_DEBUG() {
echo -e "\n$DEBUG_COLOR_ONE$1\e[0m $DEBUG_COLOR_TWO$BASH_COMMAND\e[0m";
read -s _ignore
}
# prefix a command with this to indicate that specific command should
# On Windows, install this within C:\Windows\System32\drivers\etc\hosts
###########################################################
## Dee's personal website block list
##
## THINK before you disable these!
###########################################################
### List of things that can't be blocked in the hosts-file, but instead must be blocked via Windows Defender Firewall or some other measure:
# - paperlined.org (because SecureCRT uses the direct IP address)
@DeeNewcum
DeeNewcum / logrotation.pl
Last active June 30, 2022 16:36
log rotation in Perl
use File::Temp ();
# Call the external command https://linux.die.net/man/8/logrotate
# with the specified string to be placed inside a config file.
#
# Returns true if it seemed to have run without error.
sub do_logrotate {
my ($config_directives, $is_verbose) = @_;
# $is_verbose is optional, and defaults to false
@DeeNewcum
DeeNewcum / DB.pm
Last active May 23, 2022 13:02
diff between Perl's official DB.pm (DB.pm v1.08) and Devel::Trepan's copy of DB.pm (Devel::Trepan v1.0.1)
# Perl's Core DB.pm library with some corrections, additions,
# modifications and code merged from perl5db.pl
#
# Documentation is after __END__
#
use rlib '../..';
use Devel::Callsite;
@DeeNewcum
DeeNewcum / Wordle solutions.txt
Last active January 2, 2022 23:14
Wordle strategy
NOTE: This file contains
d8b 888
Y8P 888
888
.d8888b 88888b. .d88b. 888 888 .d88b. 888d888 .d8888b
88K 888 "88b d88""88b 888 888 d8P Y8b 888P" 88K
"Y8888b. 888 888 888 888 888 888 88888888 888 "Y8888b.
X88 888 d88P Y88..88P 888 888 Y8b. 888 X88
88888P' 88888P" "Y88P" 888 888 "Y8888 888 88888P'
888
@DeeNewcum
DeeNewcum / user.js
Last active February 7, 2022 01:16
Hilight newest stories on Reddit
// ==UserScript==
// @name Hilight newest stories on Reddit
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author Dee Newcum
// @match https://old.reddit.com/
// @match https://old.reddit.com/?*
// @description Highlights text within HTML
// @require https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
@ARGV >= 1 or die "syntax: $0 <pattern> <file1> ...\n";
my $grep_pattern = shift @ARGV;
@DeeNewcum
DeeNewcum / EBMAB.pl
Last active November 11, 2018 22:20
solve \u\lennythebox's puzzle from reddit
#!/usr/bin/perl
# https://old.reddit.com/r/puzzles/comments/9vy5qm/desperately_need_help_on_number_15_this_is_from/
use strict;
use warnings;
use utf8;
use Data::Dumper;
<span style="background-color:#faa"><s>Default appears inevitable</s></span> <span style="background-color:#afa">The European Central Bank (ECB) has said it won't extend emergency funding for the banks</span> and there is a growing risk of Greece lurching out of the single currency - which has come to be known as Grexit.