Skip to content

Instantly share code, notes, and snippets.

View alksndrglk's full-sized avatar

Aleksandr Goliak alksndrglk

  • Russia, Saint-Petersburg
View GitHub Profile
@dutc
dutc / memory-analysis-case-studies.py
Last active August 21, 2022 06:56
Case Studies in Python Memory Analysis using High-Watermark Testing
#!/usr/bin/env python3
from collections import namedtuple
from functools import wraps
from inspect import signature
from itertools import islice, tee
from math import isclose
from shlex import quote
from subprocess import check_call, DEVNULL, CalledProcessError
from textwrap import dedent
@singh-abhijeet
singh-abhijeet / tree_3.py
Last active November 4, 2024 11:43
Binary Tree implementation (Py3)
class Node:
"""
Class Node
"""
def __init__(self, value):
self.left = None
self.data = value
self.right = None
class Tree:
@wtbarnes
wtbarnes / push-to-someone-elses-pr.md
Created March 5, 2020 04:49
Brief instructions for how to modify and push to someone else's PR on github

How to Push to Someone Else's Pull Request

Let's say contributor has submitted a pull request to your (author) project (repo). They have made changes on their branch feature and have proposed to merge this into origin/master, where

origin -> https://github.com/author/repo.git

Now say you would like to make commits to their PR and push those changes. First, add their fork as a remote called

@rponte
rponte / avoid-distributed-transactions.md
Last active December 3, 2025 11:31
THEORY: Distributed Transactions and why you should avoid them (2 Phase Commit , Saga Pattern, TCC, Idempotency etc)

Distributed Transactions and why you should avoid them

  1. Modern technologies won't support it (RabbitMQ, Kafka, etc.);
  2. This is a form of using Inter-Process Communication in a synchronized way and this reduces availability;
  3. All participants of the distributed transaction need to be avaiable for a distributed commit, again: reduces availability.

Implementing business transactions that span multiple services is not straightforward. Distributed transactions are best avoided because of the CAP theorem. Moreover, many modern (NoSQL) databases don’t support them. The best solution is to use the Saga Pattern.

[...]

@vasanthk
vasanthk / System Design.md
Last active December 7, 2025 14:33
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@unbracketed
unbracketed / branch-fu.md
Created April 7, 2015 17:49
Moving commits between branches

Example: Moving up to a few commits to another branch

Branch A has commits (X,Y) that also need to be in Branch B. The cherry-pick operations should be done in the same chronological order that the commits appear in Branch A.

cherry-pick does support a range of commits, but if you have merge commits in that range, it gets really complicated

git checkout branch-B
git cherry-pick X
git cherry-pick Y
@mariussturm
mariussturm / gist:0b885812500d91df8c3a
Last active January 9, 2023 12:57
Graylog2 create inputs/streams/alerts
#!/bin/bash
sleep 3
IP_ADDRESS=$(hostname -I | cut -f1 -d' ')
GRAYLOG2_URL="http://admin:admin@${IP_ADDRESS}:12900"
GRAYLOG2_INPUT_GELF_TCP='
{
"global": "true",

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name: