Skip to content

Instantly share code, notes, and snippets.

@OddBloke
OddBloke / big-graf
Last active February 2, 2024 15:17
big-graf: use grafterm to display a single full-terminal Prometheus graph
#!/bin/sh -eu
write() {
_TARGET=$1
_ADDRESS="${BIG_GRAF_PROMETHEUS_ADDRESS:-"http://localhost:9090"}"
_TITLE="${GRAPH_TITLE:-""}"
_QUERY="$(echo "${GRAPH_QUERY:-"up"}" | sed 's,",\\",g')"
_LEGEND="${GRAPH_LEGEND:-"{{ .instance }}"}"
_UNIT="${GRAPH_UNIT:-""}"
_DECIMALS="${GRAPH_DECIMALS:-0}"
@OddBloke
OddBloke / force-install.diff
Created June 22, 2023 14:50
Proof-of-Concept: unattended-upgrades patch to enable installation of high-pinned packages
diff --git a/debian/changelog b/debian/changelog
index 5491e61..64f459c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+unattended-upgrades (2.3ubuntu0.4~oddbloke) UNRELEASED; urgency=medium
+
+ * WIP
+
+ -- Daniel Watkins <daniel@daniel-watkins.co.uk> Wed, 21 Jun 2023 15:56:23 -0400
@OddBloke
OddBloke / amp.yml
Created September 13, 2021 12:28
Ansible playbook to setup headless jackd+guitarix (used on Debian bullseye)
---
- name: Set up RPi as a basic headless Guitarix amp
hosts: mirror
become_method: sudo
become: yes
tasks:
- name: Install required packages
apt:
name:
@OddBloke
OddBloke / count-stubhub-tickets.js
Created August 24, 2018 15:01
StubHub Ticket Counter
// This assumes that you are using Chrome, as it relies on the $x function in the development console
// 1) Scroll all the way down through the list of tickets, so that all of them are loaded on the page
// 2) Open the Chrome Developer Tools (Ctrl-Shift-J)
// 3) Paste the below in to the console and press return
// 4) Curse out the filthy scalpers
$x('//div[@class="ticketsText"]/text()').map(ticket_text => {
match = /(\d+) tick/.exec(ticket_text.textContent);
if (match) {
return parseInt(match[1], 10)
@OddBloke
OddBloke / .gitignore
Last active September 11, 2018 02:12
NJPW Elo
*.json
.mypy_cache
*.html
output/
njpw_results
- builder:
name: Macro
builders:
- shell: ""
- job:
name: Job
builders:
- conditional-step:
condition-kind: file-exists
@OddBloke
OddBloke / Output When Run Against example.py.txt
Created August 30, 2017 09:31
A simple typed_ast script to find nested classes
--- nested.py ---
Foo -> Bar
Foo -> Bar -> Baz
Foo -> Lolz
*InMethod -> InInMethod
Foo -> Eggs
*InFunc -> InInFunc
Second -> InSecond
InIf -> InInIf
InElse -> InInElse
@OddBloke
OddBloke / README.md
Last active August 22, 2017 09:41
eq_plugin.py: mypy plugin to check that types are only compared to themselves

How to Use

  1. Put eq_plugin.py somewhere in your project
  2. Add plugins=path/to/eq_plugin.py to the mypy section of your mypy.ini (see example in this gist)
  3. Run mypy

Example

$ cut -d: -f1 < out | cut -d/ -f1-3 | sort | uniq -c | sort -r -n
355 third_party/2and3/boto
229 third_party/2and3/jinja2
99 third_party/2and3/Crypto
81 third_party/2and3/pynamodb
43 third_party/2and3/requests
33 third_party/2and3/yaml
21 third_party/2and3/click
10 third_party/3/itsdangerous.pyi
10 stdlib/2and3/formatter.pyi