Skip to content

Instantly share code, notes, and snippets.

@giuliano108
giuliano108 / config.json
Created March 30, 2024 10:14
Karabiner Elements - Battle Axe keyboard remap
{
"description": "Battle Axe",
"manipulators": [
{
"conditions": [
{
"bundle_identifiers": [
"^com\\.BitmapBureau\\.BattleAxe$"
],
"type": "frontmost_application_if"
@giuliano108
giuliano108 / README.md
Last active April 2, 2022 18:50
Clojure 1.11 `iteration` issue?

<EDIT> Kind folks on the Clojurians Slack helped me understand how to use iteration. Turns out it works absolutely fine. Slack thread is here.

The problem was my understanding of :somef. I was using it like in this Juxt blog post (which is also incorrect) to signal iteration that there are more pages to fetch. :somef, instead, means "does the page we fetched contain any data?".

:kf is what should be used to stop iteration or letting it continue:

If (kf ret) is non-nil it will be passed to the next step call, else iteration will terminate.

The test below can be fixed by removing :somef altogether as in:

@giuliano108
giuliano108 / good.nrepl
Last active September 17, 2021 19:18
CIDER / babashka nrepl
From babashka 0.6.1, CIDER hangs as it doesn't get a reply from op IDs 6, 7 and 8 .

Guix on WSL2

(updated versions of this document, plus more, live here)

This will show you how to get Guix running on WSL2.
We're going to go as "minimal" as possible, without starting off one of the readily available WSL2 distros.
Parts of this guide should help with understanding how to set up any custom distro on WSL, not just Guix.

Disclaimer: I'm a Guix nOOb! (hence going through the trouble of installing it on WSL2)

@giuliano108
giuliano108 / README.md
Last active July 6, 2023 09:50
Flashing a CC2531 USB dongle using a Raspberry Pi 1

Flashing a CC2531 USB dongle using a Raspberry Pi 1

The examples I've seen ( 1, 2 ) all assume a "modern" Raspberry Pi with a 40-pin GPIO connector.

If you want to use a Raspberry Pi 1 (26-pin GPIO), you need to pass -r, -c and -d to the flash_cc2531 tools, based on how you want to wire things (I'm using GPIO.3->Reset, GPIO.4->DC, GPIO.5->DD).

Check the example/pictures below.

root@octopi:~# gpio readall

Keybase proof

I hereby claim:

  • I am giuliano108 on github.
  • I am giuliano108 (https://keybase.io/giuliano108) on keybase.
  • I have a public key ASB0KRXNFADFHaqXUrE4vCbNMlMeWtzk4y5y9TU6Q6AgYgo

To claim this, I am signing this object:

#!/usr/bin/perl
use strict;
=head1 SYNOPSIS
grepblock.pl <start_of_block_regexp> <match_regexp> file1 file2 ... fileN
Input files are split in blocks. Each block is delimited by `start_of_block_regexp`.
Output those blocks that match `match_regexp` (/match_regexp/ms is used).
@giuliano108
giuliano108 / ncurses.rb
Created September 30, 2014 23:15
HomeBrew ncurses formula. Includes the pkgconfig files and plays nice with goncurses.
require 'formula'
# export PKG_CONFIG_PATH=/usr/local/Cellar/ncurses/5.9/lib/pkgconfig
class Ncurses < Formula
homepage 'http://www.gnu.org/s/ncurses/'
url 'http://ftpmirror.gnu.org/ncurses/ncurses-5.9.tar.gz'
mirror 'http://ftp.gnu.org/gnu/ncurses/ncurses-5.9.tar.gz'
sha1 '3e042e5f2c7223bffdaac9646a533b8c758b65b5'
@giuliano108
giuliano108 / check_ssl_certificate.pl
Created July 15, 2014 08:27
Nagios SSL Certificate check, with SNI (SSL virtual hosting) support
#!/usr/bin/perl
=head1 SYNOPSIS
check_ssl_certificate.pl
--url,-u URL
--sni_servername,-s HOSTNAME SNI servername (SSL vhost) that will be requested during SSL handshake.
This tells the server which certificate to return.
--warning,-W days Warning alert if the cert expires in less than `days'.
--critical,-C days Critical alert if the cert expires in less than `days'.
@giuliano108
giuliano108 / NagiosGridSort.js
Last active January 2, 2016 02:09
Nagios Grid Sort
// ==UserScript==
// @name Nagios grid sort
// @namespace http://108.bz/
// @version 0.1
// @description
// @match https://nagios.blah.net/nagios/cgi-bin/status.cgi?hostgroup=blah&style=grid
// @require http://code.jquery.com/jquery-2.0.3.min.js
// @require http://tinysort.sjeiti.com/dist/jquery.tinysort.min.js
// ==/UserScript==