Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
"""
Pull images for `docker-compose build` with ignore filter.
https://github.com/docker/compose/issues/6668
The code is placed into public domain.
"""
import argparse
@abitrolly
abitrolly / README.md
Last active February 3, 2019 10:06
Phoronix - Run all recommended tests

It takes 8 days to run all Ubuntu 18.04 recommended suites on START1-S Scaleway server.

SQLite 3.22:
    pts/sqlite-2.0.1
    Test 1 of 2233
    Estimated Trial Run Count:    3
    Estimated Test Run-Time:      21 Minutes
    Estimated Time To Completion: 8 Days, 20 Hours, 27 Minutes [07:29 UTC Feb 11]
        Running Pre-Test Script @ 11:03:11
...
@abitrolly
abitrolly / layout.html
Created January 25, 2019 13:51
Sphinx content post-processing with JavaScript
<!--
Javascript to render AIRFLOW-XXX and PR references in text
as HTML links.
Overrides extrahead block from sphinx_rtd_theme
https://www.sphinx-doc.org/en/master/templating.html
-->
{% extends "!layout.html" %}
@abitrolly
abitrolly / layout.html
Created January 8, 2019 21:38
Sphinx template override to link "View Source" to code repository
<!--
1. Place this to _templates/layout.html
2. Edit source_url_prefix below to point to your repo
Overriding Alabaster Theme to replace link to static page source
with a link to GitHub. Using instructions from official guide.
https://www.sphinx-doc.org/en/master/templating.html#jinja-sphinx-templating-primer
-->
{% set source_url_prefix = 'https://github.com/bitprophet/alabaster/tree/master/docs' %}
@abitrolly
abitrolly / towncrier.py
Created January 8, 2019 10:05
Autolink for `towncrier` file from PR message
#!/usr/bin/python3
"""
Given:
- PR_URL: https://github.com/release-monitoring/anitya/pull/556
Extract:
- PR_NUMBER: gex(PR_URL, "\d+$")
- FORK
- ???
- Check: abitrolly/anitya
- BRANCH
@abitrolly
abitrolly / capacity.ipy
Created December 27, 2018 10:11
Capacity Calculator
# calculate TCLO
@abitrolly
abitrolly / stackexchange_-_grimoire.md
Last active December 26, 2018 04:01
Grimoire - Time Spell

It is about to be 15:00 and I am on a quest to measure the value of spending time to contribute to StackOverflow.

Front page of https://chaoss.github.io/grimoirelab/ leads to wordy tutorial https://chaoss.github.io/grimoirelab-tutorial/.

I need to get my activity from StackOverflow. Ideally I need to get my page views and navigation activities, but that's contributing, so let's write a comment, remove that and count the event.

@abitrolly
abitrolly / postdata.py
Last active January 28, 2024 12:00
POST JSON with Python3 urllib
# Public domain
from urllib import request
def post_data(url, data, headers={'Content-Type':'application/json'}):
"""
POST data string to `url`, return page and headers
"""
# if data is not in bytes, convert to it to utf-8 bytes
bindata = data if type(data) == bytes else data.encode('utf-8')
@abitrolly
abitrolly / entrypoint.md
Last active December 2, 2018 09:33
15 Minutes Framework

One of my friends once told me his idea that every task in the world should be achievable in 15 minutes. In a world of information overflow and constant dopamine overstimulation by mobile apps, we just don't have other choice. Our attention span shrinks to less than 3 minutes, and we can not battle it, because it is still the same dopamine loop which can be released faster when we can just check mail or Facebook. Medical industry tries to monetize on it with terms like ADD, OCD, ADHD etc., but the cause that lies in our environment can not be fixed, and the best thing we can

@abitrolly
abitrolly / nmap-docker-compose.py
Last active November 6, 2018 17:30
Detect services running on docker-compose ports with Nmap
#!/usr/bin/env python
"""
Parse docker-compose.yml port definitions and run NMAP service
scan on them to discover actual services running.
Needs nmap and Python pyyaml installed.
For now only "3000" and "8000:8000" syntax is supported.