Skip to content

Instantly share code, notes, and snippets.

View eliasdorneles's full-sized avatar

Elias Dorneles eliasdorneles

View GitHub Profile
@eliasdorneles
eliasdorneles / filter_depth_pyreverse_packages_graph.py
Created January 31, 2024 12:48
Script to filter the packages graph generated by pyreverse on depth
import argparse
import pydot
def should_delete(node_name, max_depth=2):
return node_name.count(".") >= max_depth
def truncate_node_name(node_name, max_depth=2):
return '.'.join(node_name.strip('"').split('.')[:max_depth])
@eliasdorneles
eliasdorneles / sy.md
Created July 4, 2023 16:03 — forked from cornchz/sy.md
Notes from the Mystery Machine Bus - Steve Yegge

Notes from the Mystery Machine Bus

I've spent the past eight years (starting back in June 2004) writing elaborate rants about a bunch of vaguely related software engineering issues.

I was doing all that ranting because I've been genuinely perplexed by a set of "bizarre" world-views held dear by -- as far as I can tell -- about half of all programmers I encounter, whether online or in person.

Last week, after nearly a decade of hurling myself against this problem, I've finally figured it out. I know exactly what's been bothering me.

In today's essay I'm going to present you with a new conceptual framework for thinking about software engineering. This set of ideas I present will be completely obvious to you. You will probably slap yourself for not having thought of it yourself. Or you might slap the person next to you. In fact you probably have thought of it yourself, because it is so blindingly obvious.

@eliasdorneles
eliasdorneles / example.py
Last active January 19, 2022 20:15
Stackoverflow Example
from fastapi import FastAPI, APIRouter, Request
from fastapi.responses import RedirectResponse, HTMLResponse
router = APIRouter()
@router.get('/form')
def form():
return HTMLResponse("""
<html>
@eliasdorneles
eliasdorneles / pudb_options_mockup.py
Created June 16, 2020 22:12
Alternative Option Parsing for Pudb
from __future__ import absolute_import, print_function, division
from collections import namedtuple
import sys
def exit_showing_usage():
print("""Usage: pudb [options] [SCRIPT-TO-RUN|-m MODULE] [ARGUMENTS]
Options:
@eliasdorneles
eliasdorneles / argparse_test_script.py
Created June 16, 2020 20:02
Testing argparse partial parsing
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, absolute_import, division
def run(options, script_args):
print('options', options, 'script_args', script_args)
@eliasdorneles
eliasdorneles / partoche_calc_offsets.py
Created June 1, 2020 19:37
Calculate offsets for scrolling piano sheet music
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, absolute_import, division
import itertools
import json
from PIL import Image, ImageFilter
def pairwise(iterable):
@eliasdorneles
eliasdorneles / urwid_click_example.py
Created September 11, 2019 08:29
Minimal example handling click in the terminal with Urwid
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, absolute_import, division
import urwid
PALETTE = [
('bold', 'bold', ''),
]
@eliasdorneles
eliasdorneles / plot_event_times.py
Last active May 27, 2019 16:31
Script to plot event times from a log quickly
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Plot events over a time axis
"""
# Relies on matplotlib and dateutil
from __future__ import print_function, absolute_import, division
import sys
import dateutil.parser
import datetime
@eliasdorneles
eliasdorneles / urwid_master_detail.py
Last active September 4, 2018 22:14
Sample implementation of Master-Detail UI problem for the console using urwid, written to answer an SO question: https://stackoverflow.com/a/52174629/149872
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Sample program demonstrating how to implement widgets for a master-detail UI
for a list of records using the urwid library (http://urwid.org)
"""
from __future__ import print_function, absolute_import, division
from functools import partial
import urwid
@eliasdorneles
eliasdorneles / voc-stdlib-support-status.html
Last active May 17, 2018 17:57
VOC stdlib support status
<html>
<head>
<title>VOC stdlib modules status</title>
<style>
body {
font: 1.2em "Open Sans", sans-serif;
}
.td {
padding: 2px 0;
border: 1px solid #444;