Skip to content

Instantly share code, notes, and snippets.

from __future__ import print_function
import sys
# Some color codes for terminals.
# You just print the text and color codes, and print rst to
# send the color reset sequence.
# The color sequence names are in the first bit of code below.
# Usually, just use with something like:
#!/usr/bin/perl
use warnings;
use 5.24.0;
use Text::Table;
use Getopt::Lucid qw( :all );
# Colours!
my $a_match="\033[33;1m";
my $a_close="\033[36;1m";
my $a_rst="\033[;m";
#!/usr/bin/perl
use 5.24.0;
use Text::Table;
my $data = <<'EOT';
1/16 1.5875
1/8 3.1750
3/16 4.7625
1/4 6.3500
5/16 7.9375
3/8 9.5250
#!/usr/bin/perl
# Change to a directory seen in the current tmux pane.
#
# Free for everyone for everything good, according to the author,
# jaggz.h {who is at} gmail.com. 2022-04-30
#
# https://gist.github.com/dcfdabf1f3c5576a476c283379df04c4
# Screenshot: https://i.imgur.com/22iV7j7.png
#
# Setup:
amazonChoice bestSeller position.global_position title asin price.savings_amount reviews.rating price.discounted position.position price.currency price.current_price position.page thumbnail sponsored score amazonPrime url reviews.total_reviews price.savings_percent price.before_price
4 [ 1]  0.00 0  1ct Walfront AS5048A Magnetic Encoder, PWM SPI Interface 14 Bit Fit for Brushless Motor
B08LDFJ7F4 https://www.amazon.com/dp/B08LDFJ7F4
4 [ 2]  0.00 0  7ct uxcell 7 Pcs D Shaft 20 Points 360 Degree Rotary Encoder Switch, 6 mm
B0197X1UZY https://www.amazon.com/dp/B0197X1UZY
4 [ 3]  0.00 0  1ct Rotary Encoder Aluminum Alloy Spring Bracket Holder 20mm Hole for GHS38
B08C2HHY6W https://www.amazon.com/dp/B08C2HHY6W
4 [ 4]  0.00 0  1ct Dynapar 22
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<style type="text/css">
.ef0,.f0 { color: #000000; } .eb0,.b0 { background-color: #000000; }
.ef1,.f1 { color: #AA0000; } .eb1,.b1 { background-color: #AA0000; }
.ef2,.f2 { color: #00AA00; } .eb2,.b2 { background-color: #00AA00; }
.ef3,.f3 { color: #AA5500; } .eb3,.b3 { background-color: #AA5500; }
.ef4,.f4 { color: #0000AA; } .eb4,.b4 { background-color: #0000AA; }
.ef5,.f5 { color: #AA00AA; } .eb5,.b5 { background-color: #AA00AA; }
position.position asin position.page thumbnail amazonChoice price.savings_amount title price.currency bestSeller score price.savings_percent sponsored price.before_price reviews.rating price.current_price position.global_position price.discounted reviews.total_reviews url amazonPrime
4 [ 1]  0.04 16.99 480ct BOJACK 37 Values 480 Pcs Electronics Component Fun Kit with Power Supply Module, Jumper Wire,Precision Potentiometer,830 t... B099MQV8ZW https://www.amazon.com/dp/B099MQV8ZW
4 [ 2]  0.04 12.79 300ct Hilitchi 15 Value 300pcs Variable Resistor Assorted Kit B01CV9P23C https://www.amazon.com/dp/B01CV9P23C
4 [ 3]  0.06 16.99 300ct Raogoodcx Variable Resistor Assorted Kit 15 Value 300pcs Potentiometer Kit B07ZX2CB6B https://www.amazon.com/dp/B07ZX2CB6B
4 [ 4]  0.06 17.99 300ct Sponsored Ad - BOJACK 15 Values 300 pcs 100 Ohm- 2M Ohm Variable Resistor 6mm Pot
#!/usr/bin/perl
# Outputs a 24-bit color (r,g,b) table of resistor information
# (Requires a terminal supporting 24 bit colors)
# https://gist.github.com/7928e4f3797b421a68fbffd780018727
# jaggz.h over at gmail
use Text::Table;
use utf8;
my $tb = Text::Table->new(qw/Color Digit Multiplier Tolerance/);
$tb->load(
package bansi;
# Gist url: https://gist.github.com/7b22252263719757e17ca710ac091110
use strict; use warnings;
use Exporter 'import';
our @codes = qw(
$bgbla $bgred $bggre $bgbro
$bgblu $bgmag $bgcya $bggra
$bla $red $gre $bro
#!/usr/bin/perl
# gist url: https://gist.github.com/jaggzh/f004a9917c2cb50ec2e10d24ed925dcd
# Processes CSV output from an amazon-buddy command
# About:
# Originally I wrote this for cost/pill for supplements.
# In its present state it's modified for finding syringes,
# evaluating with the regexes for "2 pack" "5ct" etc.