Skip to content

Instantly share code, notes, and snippets.

@s1037989
s1037989 / diode
Last active October 19, 2023 02:38
diode
# perl diode recv ring
# perl diode send cc00
# perl diode send ccff 0003 610062
# perl diode send ff01 0 0003 610062
# perl diode sendfile file [name]
use 5.010;
use strict;
use warnings;
use Errno;
Q:
how can i build a jenkins plugin from source, including all of its java dependencies also from source? Understand that I will have access to all source code but no active connection to the internet at all. No binary artifacts can be fetched to assist with the build process and all java jar files must be built from source only.
A:
Building a Jenkins plugin from source, along with its Java dependencies, without any internet connection and only using source code can be a complex and involved process. Here's a general guide on how you might approach this:
1. **Set Up Your Environment:**
- **Install Java and Maven:** Ensure you have Java JDK and Maven installed on your machine. Make sure you're using compatible versions with the Jenkins source code.
79275263102d493ceae5f8b34bb922d3e7bcff70f8d6aed7a13c6c7ac0e6daa87dbfeb84a1fc3e2c9eafb738a0d7e3f3943225d59d63954fd71df2a3f09ca11d4622eeaed1ae96a9a36aa70725e23f77bbf7330cad97b1e91372d1346f1977c840f51c4cf479276e554742b81b5273423b3e4dd51b9b1c076588d5aa9eda62d7eccc808d441d93064243b4bb3117e7d6590463f3ed4352c9317eb8f55b21fa24e2cf1a680fe21cf3c90b1f1df0c88925b0cb43d16ae20d84b85211634471370cd314a0f331e483d22d37564416aef30f66fe5f18f9edee0503c7c1616f198567b71420712eaed12070ee238fda8facca5b3af1d4d125c74035f2b5ed0a5e967610742fba40100abdaaa5e7acef34526f345588acbcfaa8d7f9224c0a260631940c582622e7b0cdeaebb9ee8a32c1bf4556b04f20f2ece7068c9dfab199652affdf4426ac50ba853d7b813c48da3c3c33b7d3ca7f09fe7a22dfb67d4e4531cd845e3aa2fd1b8940b79bfcffc3420286681b85f9b839454a6809b8b29815baf330b98b9c1ee7a0d7bdf1819ba760c3cc22fd83f494372091f02d5212235b334a2b3018f61e085c4568f6ee54d5c7f33626777bbd81062e8681292e9c288438d625adfcf62f97f4d8af56d36f5cfbe34426866665a0c55505223e7608fca3a4dc782ca0224b82109682c28ef1f9967a44046a26721ed6bba4ec87e3bd508ba36fd8
@s1037989
s1037989 / aes.pl
Last active August 19, 2023 02:29
encrypt and decrypt
#!/usr/bin/env perl
# $ perl aes.pl decrypt $(perl aes.pl encrypt 123 qaz) # 123 is the key and qaz is the plaintext
# qaz # qaz is the plaintext from the 123 ciphertext encryption
# $ key=123 ciphertext=08eaad9aec6b6ccba1067aa4de838dd3d5c6423024d5eb087a4e70cd32b9caba
# $ perl aes.pl decrypt $key $ciphertext
# qaz
# $ perl aes.pl decrypt 40bd001563085fc35165329ea1ff5c5ecbdbbeef40bd001563085fc35165329e $ciphertext
# qaz # 40b...29e is the actual key derived from 123 and used in the enc/dec
@s1037989
s1037989 / gist:dba3217fddba2bc61f4c77f2f24185e7
Created July 26, 2023 22:22
reduce a list of dates to those less than X
$ perl -Mojo -MTime::Piece -E 'say c(qw(2022.11 2022.12 2023.01 2023.02 2023.03 2023.04 2023.05 2023.06 2023.07))->reduce(sub{push @$a, $b if Time::Piece->strptime($b, "%Y.%m") < Time::Piece->strptime($ARGV[0]||localtime->strftime("%Y.%m"), "%Y.%m"); $a}, c())->join(",")' 2023.02
2022.11,2022.12,2023.01
@s1037989
s1037989 / extract-hmackey
Created July 24, 2023 23:06
Brute force FIPS HMAC Key extract from binaries
#!/bin/bash
# This allows modifying a library with, e.g., patchelf and updating the FIPS-required .libXXX.hmac
# to ensure that the library can be loaded on a FIPS-enabled system.
# $ extract-hmackey libcrypto.so.1.1 '^[A-Za-z0-9 ]+$' '.\{16,64\}'
# orboDeJITITejsirpADONivirpUkvarP
# success
# $ extract-hmackey libcrypto.so.1.1 '^a$' '.\{16,64\}'
# fail
exec 73>&- 74<&- 74> >(perl -nE 'say "...$_..."') 73> >(LANG=C exec stdbuf -o0 perl -nE 'say ,,,$_,,,' >&74 2>&1)
function perl::start {
read TMPDIR < <(/usr/bin/mktemp -d /dev/shm/conn_shell_XXXXXXX)
mkfifo $TMPDIR/perl
nextFd PERLIN
echo $PERLIN
eval "exec $PERLIN> >(LANG=C exec stdbuf -o0 -i0 perl -pE '\$_="1\n\r"' >$TMPDIR/perl 2>&1)"
nextFd PERLOUT
echo $PERLOUT
# src is a staging area... copy files into src and then backup src to have them moved de-duped to dst
unset MYHOST STAGINGDIR BACKUPDIR REMOTEHOST REMOTEDIR
test -f ~/.backuprc && . ~/.backuprc
: ${MYHOST:=${HOSTNAME:-$(hostname -f)}}
: ${STAGINGDIR:=~/.backup}
STAGINGDIR=${STAGINGDIR/%//$MYHOST}; test -d $STAGINGDIR || mkdir -p $STAGINGDIR
: ${BACKUPDIR:=~/backup}
FILESTORE=$BACKUPDIR/.filestore; test -d $FILESTORE || mkdir -p $FILESTORE
BACKUPDIR=${BACKUPDIR/%//$MYHOST};
@s1037989
s1037989 / bashrc.md
Last active May 12, 2023 12:14
Multiple bash_histories

Maintain separate bash_histories and remember the last pwd for each tmux session/window/pane!

This is useful for setting up tmux project sessions with multiple windows and panes. Each time you create a new tmux session with the same name as a previous session, each windows' pane will maintain it's own separate bash_history and pwd!

This is very useful for long-running tmux sessions, especially when something happens to any of the shells. That very complex but useful log tailer that was started 6 months ago? It's the last command that was run ... in that pane!

Pay attention to the pwd and command history for each of the split-window panes in tmux!

asciicast

package Mojolicious::Plugin::Minion::Schedule;
use Mojo::Base 'Mojolicious::Plugin', -signatures;
use Algorithm::Cron;
use Minion::Job;
use Mojo::Date;
use Mojo::JSON qw(j);
use Mojo::Util qw(monkey_patch sha1_sum);
monkey_patch 'Minion::Job',