Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View jettero's full-sized avatar
🕸️
Hliðskjálf

Paul Miller jettero

🕸️
Hliðskjálf
View GitHub Profile
#!/bin/bash
# simple jq task: reduce list of objects with by workflow_id and job id
# into a object { workflow_id => [list of job ids] }
#
# .o(this seriously took like 2 whole hours ot figure out)
gh api repos/$owner_slash_repo/actions/runs?per_page=100 \
| jq '[ .workflow_runs | group_by(.workflow_id)[] | {(.[0].workflow_id|tostring): [ .[] | .id ]} ]
| reduce .[] as $item ({}; . * $item)'
In [8]: import re
...: import subprocess
...: def get_ext_info(dev):
...: try:
...: output = subprocess.check_output(['sudo', 'dumpe2fs', '-h', dev], stderr=subprocess.DEVNULL).decode()
...: except:
...: pass
...: data = dict()
...: for line in output.splitlines():
...: if m := re.match(r'^([^:]+):\s+(.+)$', line):
@jettero
jettero / black.vim
Created November 9, 2021 14:10
A function to invoke psf-black in vim without any plugins or their frankenstalled virtual environment mini-pseudo-python-distro-hidden-directory-thing
fun Blackify()
let l:bsave = winsaveview()
let l:tname = tempname()
exe 'keepjumps %!black --line-length 119 -q - 2>' . l:tname
if v:shell_error > 0
let l:lines = readfile(l:tname)
for l:line in l:lines
echo l:line
endfor
call delete(l:tname)
@jettero
jettero / gh-latest.sh
Last active June 17, 2021 16:57
every time I think to use 'gh', it needs an update... automate
#!/bin/bash
set -e
curl -s https://api.github.com/repos/cli/cli/releases/latest \
| grep "browser_download_url.*amd64.*deb" \
| cut -d : -f 2,3 \
| tr -d \" \
| wget -O ~/Downloads/gh-latest-linux-amd64.deb --progress=bar:force -T15 -t100 -i -
@jettero
jettero / .gitconfig
Last active February 17, 2021 16:55
# Personally I feel completely blind without my various logs. Especially
# `ftlog` for when I just can't figure out where I am in the tree.
#
# Every now and again, when people I'm helping with git that are feeling
# totally lost, I wish they had these commands. in reality, they totally do,
# `mylog` could probably just be `log --oneline`; but my format reveals details
# to help me figure out where I actually am. In particular, the commit id (%h)
# -- and/or reflog selector (%ar), the committer email (%ae), and the head and
# branch names (%d) where they occur in the tree. I suppose it helps an awful
# lot to know the human relatable timestamp too (%ar).
// ==UserScript==
// @name No Polymer Youtube Homepage
// @namespace https://gist.github.com/jettero
// @version 0.3
// @description Google keeps pusing their new shitty homepage layout with 4 recommendations. This is clearly to make advertising computation easier, but: no thanks. Until they break their classic view, that's how ima look at it.
// @author jettero
// @match https://www.youtube.com/*
// @downloadURL https://gist.github.com/jettero/9ffdfa504d6f1d115fe9ae0cdb1ba186/raw/no-polymer-youtube-home.user.js
// @grant none
// ==/UserScript==
@jettero
jettero / stable.factorio.wiki.user.js
Last active September 3, 2019 13:51
force stable factorio wiki
// ==UserScript==
// @name Factorio Wiki Force Stable
// @namespace org.voltar.factorio.annoyance
// @version 0.1
// @downloadURL https://gist.github.com/jettero/8e232d72111ac8b4e3b53c13635589ce/raw/stable.factorio.wiki.user.js
// @description I play the stable factorio. I almost never want the unstable wiki.
// @author jettero
// @match https://wiki.factorio.com/*
// @grant none
// ==/UserScript==
@jettero
jettero / git-tls.sh
Created August 29, 2019 14:22
shell scirpt to list git tags along with their description and an annotation indicator ([t] for annotated/signed and [c] for unsigned/annotated)
#!/usr/bin/env bash
FMT=$'--pretty=format:{}%x1f%C(bold yellow) %h%C(bold blue) %ae%Creset: %s %C(bold black)%ar%Creset%n'
git tag -l | xargs -rn1 -I{} git log -1 "$FMT" {} | while read X
do commit="$(cut -d $'\x1f' -f1 <<< "$X")"
description="$(cut -d $'\x1f' -f2 <<< "$X")"
# use cat-file -t to add add [c] or [t]
#
# Wait, but why??
@jettero
jettero / wget.py
Created June 4, 2019 16:01
wget json gadget for splunk
#!/usr/bin/env python
# supports_getinfo allows us to specify all but maxinputs and filename at parse time
# [wget]
# supports_getinfo = True
# maxinputs = 0
# filename = wget.py
import sys, time, json
from collections import OrderedDict
import splunk.Intersplunk as si
@jettero
jettero / tf-graph-scene.css
Last active December 7, 2019 17:37
attempt to make tensorboard graph svg text redable when using a minimum-font-size in firefox
/* intended to be used with stylus (user-css add-on) or similar
** no copyright intended
**
** Basically the problem is that I use a minimum font size in firefox to ensure
** sites can't set fonts smaller than I can read. Zooming the sites is not an
** acceptable option because it also jacks up the layout. minimum font size
** works nearly everywhere except for single edge cases like tensorboard's SVG
** text ... and I can't think of a single other example at the moment.
**
** update: