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@m1: ~/c/a/ansible-dev-environment fix/de
$ tox -e docs
.pkg: _optional_hooks> python /Users/ssbarnea/.asdf/installs/python/3.12.1/lib/python3.12/site-packages/pyproject_api/_backend.py True setuptools.build_meta
.pkg: get_requires_for_build_editable> python /Users/ssbarnea/.asdf/installs/python/3.12.1/lib/python3.12/site-packages/pyproject_api/_backend.py True setuptools.build_meta
.pkg: build_editable> python /Users/ssbarnea/.asdf/installs/python/3.12.1/lib/python3.12/site-packages/pyproject_api/_backend.py True setuptools.build_meta
docs: install_package> python -I -m pip install --force-reinstall --no-deps .tox/.tmp/package/35/ansible_dev_environment-1.dev11-0.editable-py3-none-any.whl
docs: commands_pre[0]> sh -c 'rm -f .coverage* coverage.xml 2>/dev/null || true'
docs: commands[0]> mkdocs build
docs: exit 2 (0.00 seconds) /Users/ssbarnea/c/a/ansible-dev-environment> mkdocs build
.pkg: _exit> python /Users/ssbarnea/.asdf/installs/python/3.12.1/lib/python3.12/site-packages/pyproject_api/_backend.p
$ mk pending
Found molecule draft release v7.0.0 created 36 days ago:
## Major Changes
- Set Python 3.10 as minimum version (#4099) @cristianonicolai
## Bugfixes
@ssbarnea
ssbarnea / .profile
Created May 26, 2011 19:21
Bash script for setting up OS X for power users
alias dos2unix-recursive='find . -iname '*.tpl' | xargs dos2unix'
alias edit='mcedit'
alias del='rm'
alias deltree='rm -r'
alias dir='/bin/ls $LS_OPTIONS --format=vertical'
alias attrib='chmod'
alias chdir='cd'
alias copy='cp'
alias ls='ls -a'
@ssbarnea
ssbarnea / pip-doctor.py
Created October 10, 2023 09:40
Script to report broken packages and uninstall and reinstall them.
#!/usr/bin/env python
from os.path import isfile
import subprocess
from email.parser import Parser
from pip._internal.metadata import get_default_environment
from pip._internal.utils.compatibility_tags import get_supported
from pip._vendor.packaging.tags import parse_tag
supported = get_supported()
packages = get_default_environment().iter_installed_distributions()
@ssbarnea
ssbarnea / test_ansi.py
Created October 26, 2011 16:18
ANSI support detection code for Python.
#!/usr/bin/env python
import sys, os, time, platform
sample_ansi = '\x1b[31mRED' + '\x1b[33mYELLOW' + '\x1b[32mGREEN' + '\x1b[35mPINK' + '\x1b[0m' + '\n'
for handle in [sys.stdout, sys.stderr]:
if (hasattr(handle, "isatty") and handle.isatty()) or \
('TERM' in os.environ and os.environ['TERM']=='ANSI'):
if platform.system()=='Windows' and not ('TERM' in os.environ and os.environ['TERM']=='ANSI'):
@ssbarnea
ssbarnea / keytool-trust
Created October 4, 2012 13:14
Bash script that installs SSL certificates from different services to JVMs.
#!/bin/bash
REMHOST=$1
REMPORT=${2:-443}
CACERTS=$3
KEYSTORE_PASS=changeit
KEYTOOL=keytool
# /etc/java-6-sun/security/cacerts
#!/usr/bin/env python
import ctypes
import getpass
import os
import sys
import subprocess
import pytest
import platform
import shutil
import warnings
---
- name: cleanup
hosts: localhost
gather_facts: false
tasks:
- name: Cleanup
debug:
msg: "Doing cleanup"
- name: Foo
Resolved settings for: "/Users/ssbarnea/c/a/ansible-lint/.projects/ansible-compat/src/ansible_compat/__init__.py"
Settings path: "/Users/ssbarnea/c/a/ansible-lint/.projects/ansible-compat/pyproject.toml"
Settings {
rules: RuleTable {
enabled: {
MixedSpacesAndTabs,
MultipleImportsOnOneLine,
ModuleImportNotAtTopOfFile,
MultipleStatementsOnOneLineColon,
MultipleStatementsOnOneLineSemicolon,
@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)