Skip to content

Instantly share code, notes, and snippets.

View ssbarnea's full-sized avatar
🎄
Sticking packages under the pypi tree.....

Sorin Sbarnea ssbarnea

🎄
Sticking packages under the pypi tree.....
View GitHub Profile
@ssbarnea
ssbarnea / capture.py
Last active March 30, 2023 11:18
Script that captures both stdout and stderr in a way that works for subprocesses, while still being able to use rich own console to use original streams.
from rich.console import Console
from subprocess import run
import tempfile
import sys
from contextlib import redirect_stdout, redirect_stderr
# If we do not pass file=sys.stdout explicitly, rich output will also be
# captured by the context manager.
console = Console(file=sys.stdout)
console_err = Console(file=sys.stderr, stderr=True)
@kalebo
kalebo / subprocess_tee.py
Last active March 13, 2024 20:53
Emulate tee with python's async subprocess (>= 3.6)
class RunOutput():
def __init__(self, returncode, stdout, stderr):
self.returncode = returncode
self.stdout = stdout
self.stderr = stderr
# the following three commands are adapted from https://kevinmccarthy.org/2016/07/25/streaming-subprocess-stdin-and-stdout-with-asyncio-in-python/
async def _read_stream(stream, callback):
while True:
line = await stream.readline()
@egmontkob
egmontkob / Hyperlinks_in_Terminal_Emulators.md
Last active May 3, 2024 11:35
Hyperlinks in Terminal Emulators
@jglick
jglick / JENKINS-41745-proposal.md
Last active August 22, 2017 18:22
Proposal for JENKINS-41745: Remoting-free CLI

Summary

JENKINS-41745: Deprecate the Remoting-based protocol for the Jenkins CLI feature. Enhance the client and server to conveniently perform most existing CLI tasks with simpler and safer protocols.

Goals

@rponte
rponte / get-latest-tag-on-git.sh
Last active March 11, 2024 07:50
Getting latest tag on git repository
# The command finds the most recent tag that is reachable from a commit.
# If the tag points to the commit, then only the tag is shown.
# Otherwise, it suffixes the tag name with the number of additional commits on top of the tagged object
# and the abbreviated object name of the most recent commit.
git describe
# With --abbrev set to 0, the command can be used to find the closest tagname without any suffix:
git describe --abbrev=0
# other examples
@jashkenas
jashkenas / semantic-pedantic.md
Last active November 29, 2023 14:49
Why Semantic Versioning Isn't

Spurred by recent events (https://news.ycombinator.com/item?id=8244700), this is a quick set of jotted-down thoughts about the state of "Semantic" Versioning, and why we should be fighting the good fight against it.

For a long time in the history of software, version numbers indicated the relative progress and change in a given piece of software. A major release (1.x.x) was major, a minor release (x.1.x) was minor, and a patch release was just a small patch. You could evaluate a given piece of software by name + version, and get a feeling for how far away version 2.0.1 was from version 2.8.0.

But Semantic Versioning (henceforth, SemVer), as specified at http://semver.org/, changes this to prioritize a mechanistic understanding of a codebase over a human one. Any "breaking" change to the software must be accompanied with a new major version number. It's alright for robots, but bad for us.

SemVer tries to compress a huge amount of information — the nature of the change, the percentage of users that wil

@smirn0v
smirn0v / gist:b8e6c4bedebed23a0328
Last active February 24, 2023 09:44
Edit gerrit project config
# checkout
git fetch origin refs/meta/config:refs/remotes/origin/meta/config
git checkout meta/config
#directly:
git push origin meta/config:meta/config
#via review:
git push origin meta/config:refs/for/refs/meta/config
# How to install `ipkg` on a Synology DS214
After a couple of days of trying to get `ipkg` woking on my DS214 I found [this article](https://github.com/trepmag/ds213j-optware-bootstrap) by [trepmag](https://github.com/trepmag). It is written for the DS213j, but it’s been working for me and [others](https://github.com/alberthild) for the DS214 too.
I have done some minor changed to clarify some things, but if you are a Linux guy (unlike me) my changes might be of no use to you.
## Guide
@mdpatrick
mdpatrick / postgresql_9.1_to_9.3_on_ubuntu_12.04
Last active June 21, 2018 10:35
Upgrade PostgreSQL from 9.1 to 9.3 on Ubuntu 12.04
# Probably excessive, but it makes these instructions simpler
sudo -i
# Add postgresql repo and update apt listing
echo "deb http://apt.postgresql.org/pub/repos/apt/ squeeze-pgdg main" > /etc/apt/sources.list.d/pgdg.
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
apt-get update
# For some reason this is necessary with PostgreSQL on Ubuntu 12.04
update-alternatives --remove postmaster.1.gz /usr/share/postgresql/9.1/man/man1/postmaster.1.gz
@mikhailov
mikhailov / nginx.conf
Last active October 7, 2018 10:15
Jira connection optimised (Nio enabled, gzip disabled on Tomcat, but enabled on Reverse proxy side, Proxy with HTTP 1.1 keep-alive, SSL offload, SPDY). Nginx 1.5.10+ recommended.
echo 'events {
worker_connections 1024;
}
error_log /usr/local/Cellar/nginx/1.5.8/error.log;
http {
include mime.types;
default_type application/octet-stream;
sendfile on;