Skip to content

Instantly share code, notes, and snippets.

@giuliano108
giuliano108 / phonesonoff.rb
Created June 12, 2013 23:02
Given a Cisco switch, enable/disable power on every PoE port that has an IP Phone connected to it.
#!/usr/bin/env ruby
# - Connects to a Cisco switch
# - Asks CDP which ports have an "IP Phone" connected to them
# - On every such port, turn PoE on or off
#
# -- giuliano@108.bz
require 'greenletters'
require 'trollop'
@giuliano108
giuliano108 / README.md
Last active December 28, 2015 09:58
d3.layout.colgrid

d3.layout.colgrid

Takes a list of columns (a matrix where the columns can have different lengths) and arranges every element on a grid. Inspired by d3.layout.grid.

Click for a demo.

@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==
@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 / 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'
#!/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).

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:

@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

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 / 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 .