Skip to content

Instantly share code, notes, and snippets.

@dgulino
dgulino / gerrit_waybar.py
Last active June 12, 2023 19:32
waybar custom script to display open gerrit reviews
#!/usr/bin/env python3
##!/usr/bin/python3
# -*- coding: utf-8 -*-
import os
import sys
import json
import subprocess
@dgulino
dgulino / ngraph.fs
Last active January 4, 2022 01:00
ncurses numerical plotter
#! /usr/local/bin/gforth
variable width
variable height
variable maxnum
100 maxnum !
variable num-digits
4 num-digits !
variable effective-width
variable partial-char
@dgulino
dgulino / ngraph.py
Last active December 22, 2021 19:30
ncurses numerical plotter
#!/usr/bin/env python
# Copyright 2021 Drew Gulino
# #This program is free software; you can redistribute it and/or modify
# # it under the terms of the GNU General Public License as published by
# # the Free Software Foundation; either version 2 of the License, or
# # (at your option) any later version.
# #
# # This program is distributed in the hope that it will be useful,
# # but WITHOUT ANY WARRANTY; without even the implied warranty of
{
"meta": {
"theme": "onepage"
},
"basics": {
"name": "Drew Gulino",
"label": "Senior Software Developer (SRE)",
"picture": "",
"email": "drew.gulino@gmail.com",
"phone": "",
@dgulino
dgulino / ddiff
Last active January 16, 2018 16:17
Graphic diff of file across multiple remote machines via SSH
#!/usr/bin/env ruby
#osx: brew install diffuse
#linux rpm: rpm install diffuse
require 'optparse'
require 'pp'
options = {}
OptionParser.new do |parser|
parser.define_head "Distributed Diff"
parser.on('-h', '--hosts HOSTS') do |v|
require Logger
defmodule Tgraph do
def main(args) do
Logger.info inspect args
options = parse_args(args)
f = Dict.get(options,:file,:stdio)
case is_atom(f) do
true -> f
@dgulino
dgulino / runavg.py
Last active December 29, 2015 08:29
Outputs a simple average of all numbers, or given a size of numbers to group, will output a running average.
#!/usr/bin/env python
"""$ c=1;while true;do echo $c;let c=$c+1;sleep .5;done | ./avg.py -n 10
5.5
15.5
25.5
..."""
#Copyright 2005 Drew Gulino
##This program is free software; you can redistribute it and/or modify
@dgulino
dgulino / runavg.erl
Last active December 12, 2015 09:18
Output chunked average of numeric stream The main use case is when I'm looking into a problem, and tailing a log. Too much data. Awk/perl/pyline the interesting numbers and tail that. Numbers running too fast or changing too often to see a pattern. So I then pipe the number stream through a block average and then to tgraph. tail -f some.log | aw…
#!/usr/bin/env escript
%% -*- erlang -*-
%%! -smp disable
%% Author: Drew Gulino
-module(runavg).
-export([main/1]).
main(CmdLine) ->
OptSpecList = option_spec_list(),
@dgulino
dgulino / tgraph.erl
Last active December 12, 2015 09:18
Console plotting in erlang script (escript)
#!/usr/bin/env escript
%% -*- erlang -*-
%%! -smp disable
%% Author: Drew Gulino
-module(tgraph).
-export([main/1]).
main(CmdLine) ->
OptSpecList = option_spec_list(),
@dgulino
dgulino / timedcount.py
Last active August 24, 2021 14:13
Python console application that takes a stream of newline delimited characters (lines) and returns the count of these lines every N seconds.Nice way, in combination with grep, to keep track of certain activity in a log
#!/usr/bin/env python
#Copyright 2007 Drew Gulino
##This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the