Skip to content

Instantly share code, notes, and snippets.

@s1037989
s1037989 / sign.sh
Last active June 30, 2022 23:16 — forked from ezimuel/sign.sh
Sign and verify a file using OpenSSL command line tool. It exports the digital signature in Base64 format.
function gen_keys {
[ -z "$1" ] && { echo "Usage: $FUNCNAME passphrase"; return 1; }
local passphrase="$1" privatekey=$(mktemp) publickey=$(mktemp)
openssl genrsa -aes128 -passout pass:"$passphrase" -out $privatekey 2048 >/dev/null
openssl rsa -in $privatekey -passin pass:"$passphrase" -pubout -out $publickey >/dev/null
printf "Private Key: %s\nPublic Key: %s\n" $privatekey $publickey
}
function sign_file {
[ -z "$2" ] && { echo "Usage: $FUNCNAME file privatekey publickey"; return 1; }
@s1037989
s1037989 / carton-setup.sh
Last active July 7, 2017 06:23 — forked from hatak/carton-setup.sh
install perlbrew + cpanm + carton
#!/bin/bash
PERL_STABLE="5.26.0"
echo '%< --- installing perlbrew ---'
echo
echo 'If this fails, apt install build-essential'
curl -kL http://install.perlbrew.pl | bash
source ~/perl5/perlbrew/etc/bashrc
@s1037989
s1037989 / URLQueue.pl
Created November 16, 2016 17:30 — forked from jberger/URLQueue.pl
Modularization of my answer from SO on URL queuing for non-blocking ua
#!/usr/bin/env perl
package Mojo::URLQueue;
use Mojo::Base 'Mojo::EventEmitter';
use Mojo::UserAgent;
has queue => sub { [] };
has ua => sub { Mojo::UserAgent->new(max_redirects => 5) };
has concurrency => 4;