Skip to content

Instantly share code, notes, and snippets.

@ab
ab / signals_test.py
Created January 13, 2021 22:29
Python script that prints pstree and loops forever, gracefully exiting on SIGINT/SIGTERM, useful for debugging process managers / deploy behavior
#!/usr/bin/env python3
import collections
import logging
import os
import psutil
import signal
import sys
import time
logger = logging.getLogger(__name__)
#!/usr/bin/env python
from ddtrace import tracer
@tracer.wrap()
def traced():
return "Traced"
def not_traced():
return "Not traced"
@ab
ab / pixeltest.html
Created July 31, 2017 03:00
Dead pixel test page
<!doctype html>
<html>
<head>
<title>Pixel test page</title>
</head>
<body>
<div id="nav">
<a href="?black" style="color:black">black</a>
<a href="?white" style="color:white; background: gray">white</a>
<a href="?red" style="color:red">red</a>
@ab
ab / test-block.rb
Created July 5, 2017 05:05
Case study to demonstrate jruby block bug https://github.com/jruby/jruby/issues/4217
#!/usr/bin/env ruby
class Foo
attr_reader :failed
def initialize
@failed = false
end
def [](foo, &block)
@ab
ab / github-print-bookmarklet.js
Last active October 19, 2016 02:39
Github Print Bookmarklet (like others, but does not require jQuery). Paste the minified javascript: into a bookmark to use it.
/* Remove stuff from the page to make github pages pretty for printing */
console.log("Github pretty print 0.1");
function removeClassElems(name) {
console.log("looking for class:", name);
Array.from(document.getElementsByClassName(name)).forEach(function(e) {
console.log("Removing", e);
e.parentNode.removeChild(e);
});
@ab
ab / πŸ’©.rb
Last active November 16, 2020 22:25
#!/usr/bin/env ruby
alias πŸ“„ puts
class AπŸ–₯
@@🐴 = {
πŸ˜‚: 'Hello, world!',
πŸ™ƒ: 'HALP',
πŸ–₯: 'computer.',
}
@ab
ab / cut-month.sh
Created December 15, 2015 11:17
Glue scripts for cutting together time lapse video
#!/bin/bash
set -eu
if [ $# -ne 3 ]; then
cat >&2 <<EOM
usage: $(basename "$0") YEAR MONTH {high|low|concat-only}
EOM
exit 1
fi
#!/usr/bin/env bash
#
# Syncs Ruby binstubs for ruby-communal-gems.
# Run this everytime you install a new Ruby, or when you install a new gem
# with a bin/ command. (ie, when you typically do rbenv rehash)
#
# See: https://github.com/tpope/rbenv-communal-gems/issues/5
#
set -eu
#!/usr/bin/env python
import imaplib
import os
import logging
import optparse
# LABEL = 'support'
# QUERY = 'before:2015-06-01 -label:to-delete'
# DEST = 'to-delete'
LABEL = 'to-delete'
@ab
ab / AA_dmarc.rb_MOVED.md
Last active August 11, 2020 22:06
DMARC analysis: some hacks to look at DMARC vendors. MOVED TO https://github.com/ab/dmarc-analysis