Skip to content

Instantly share code, notes, and snippets.

@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')
Home Collection were music compilations made by fans for fans
and sold as CDs on flea market in post-soviet Minsk. At that
time, which is around 2000, the internet was overly expensive,
the salaries were extremely low. Flavoring juice on the table
was a sign of a celebration. Normally we would rather count
cash and buy beer to socialize once in a few weeks.
* [ ] https://archive.org/
Home Collection was a way to discover new music, which was not
# public domain code
# useful for csv output etc.
def format_table(rows, headers):
"""Format list of tuples into equal width table with headers"""
maxlens = [len(h) for h in headers]
for r in rows:
for i, c in enumerate(r):
maxlens[i] = max(maxlens[i], len(c))
tpltpl = []
@abitrolly
abitrolly / tosca.notes
Last active January 25, 2022 19:06
TOSCA
TOSCA is a way to describe application infrastructure. Designed by comittee called OASIS.
If you want to look at it, start with Eclipse Winery.
Because Winery is a Java app, nobody runs online demo, so you need to run it yourself
(there is probably a fresh recorded demo somewhere, so post a link if you've seen one)
Winery is a UI that allows you to draw diagrams that are then saved as CSAR files.
CSAR files contain TOSCA diagrams in YAML format that defines infrastructure like
@abitrolly
abitrolly / vimnotes
Last active November 2, 2021 10:20
Notes from Vim masterclass by @vitaly-zdanevich @ Minsk Hackerspace
-- Modes --
i #
v # visual selection mode
Ctrl+v # visual block selection
ESC
Ctrl+o # in insert mode - run one command in normal mode
{
project(fullPath: "gitlab-org/gitlab") {
name
issues {
nodes {
iid
timelogs {
nodes {
spentAt
timeSpent
@abitrolly
abitrolly / busy.png
Last active July 30, 2021 15:39
Capacity Based Approach to DevOps
busy.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@abitrolly
abitrolly / gist:2fad741274d7620c1f6ca9cc0b8ddd8e
Last active April 29, 2021 10:01
Dependency Tracking / Mapping
Master thread - https://discourse.sustainoss.org/t/dependency-mapping-working-group/569 - see Agenda items there.
* https://deps.cloud/ - some initiative to detect and parse dependencies
* https://github.com/dependabot/dependabot-core - it somehow parses GitHub files
1 0.008 3
1 0.012 4
1 0.005 2
1 0.016 5
1 0.002 1
1 0.008 3
1 0.002 1
1 0.002 1
1 0.005 2
1 0.005 2