Skip to content

Instantly share code, notes, and snippets.

View willsheppard's full-sized avatar

Will Sheppard willsheppard

View GitHub Profile
@willsheppard
willsheppard / jq_cheat_sheet.md
Last active November 9, 2023 20:05
jq cheat sheet
@willsheppard
willsheppard / knex.js
Created July 13, 2022 13:49
Knex basics
knex.select()
.from('some_table')
.where({
name: 'Mr Foo'
})
.then((result) => {
// This block is *REQUIRED* or the query is not sent to the database!
if (! result[0]) {
console.log(`Error: "Mr Foo" was not found.`);
process.exit(1); // It is alright to exit here *IF* it's a fatal condition
@willsheppard
willsheppard / discord1.jq
Created February 18, 2022 15:38
Stream filter for discord chat export
if .[0][2] == "timestamp" then .[1],"\t" else empty end,
if .[0][2] == "content" then .[1],"\t" else empty end,
if .[0][2] == "author" and .[0][3] == "name" then .[1],"\t" else empty end,
if .[0][2] == "author" and .[0][3] == "nickname" then .[1],"\t" else empty end,
if .[0][2] == "attachments" and .[0][4] == "url" then .[1],"\t" else empty end,
if .[0][2] == "mentions" and (.[1] | not) then "\n" else empty end
@willsheppard
willsheppard / wide-character-in-print-perl-utf8.out
Last active November 23, 2021 15:14
Wide character in print, perl UTF-8 tips
$ perl -le 'print "\x{2603}"';
Wide character in print at -e line 1.
$ perl -CSDL -le 'print "\x{2603}"';
@willsheppard
willsheppard / todo-test2.md
Created September 16, 2021 14:04
To do list for improving Test2 documentation

TODO

Improve the docs

lib/Test2/Tools/Compare.pm

[ ] Add subheadings for each method
[ ] Add to the ADVANCED synopsis with more useful stuff
[ ] Make the 'import' policy easier to understand

[ ] Show how to import everything easily

@willsheppard
willsheppard / improving-cpan-docs.md
Last active September 16, 2021 14:52
[Adventures in improving CPAN modules documentation] #perl #cpan #docs #pod

Case study

Test2 documentation could do with some improvement.

How to view POD

vi

  • Easy to edit, not so easy to view.
  • I don't want to mess around with vim plugins, or even mdless
@willsheppard
willsheppard / metacpan-docker-mac-osx-13.6-fail-unsupported.log
Last active September 16, 2021 13:12
Failing to get the metacpan docker image to work on Mac OSX 13.6 High Sierra
# Failing to get the metacpan docker image to work on Mac OSX 13.6 High Sierra.
# Note: Docker specifically says my version of Mac OSX is not supported: https://docs.docker.com/desktop/mac/install/
Mac [12:35 alt$] git clone https://github.com/metacpan/metacpan-docker.git
Cloning into 'metacpan-docker'...
remote: Enumerating objects: 643, done.
remote: Counting objects: 100% (31/31), done.
remote: Compressing objects: 100% (27/27), done.
remote: Total 643 (delta 6), reused 18 (delta 2), pack-reused 612
@willsheppard
willsheppard / build_dbd_mysql.md
Last active September 16, 2021 13:28
How to compile DBD::mysql for Perl, on Mac OSX

1. install the version of mysql you want

e.g. to:

~/opt/mysql/8.0.22

Maybe use dbdeployer for this (see other post)

2. set up the environment

@willsheppard
willsheppard / hosts
Created January 6, 2021 11:00
Safe search host settings
54.229.105.151 duckduckgo.com
54.229.105.151 www.duckduckgo.com
213.180.193.56 yandex.ru
213.180.193.56 www.yandex.ru
216.239.38.120 google.com
216.239.38.120 www.google.com
204.79.197.220 bing.com
204.79.197.220 www.bing.com
#216.239.38.119 youtube.com # blocks too much
@willsheppard
willsheppard / mojo_useragent_interface.pl
Created October 14, 2020 15:07
Better interface for Mojo::UserAgent
# Existing Mojo::UserAgent interface:
->get('www.☃.net?hello=there' => {Accept => '*/*'});
->post('https://example.com' => json => {top => 'secret'});
# Alternative improved interface (proposed):
->get({
url => 'www.☃.net?hello=there',