This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~/Pr/co/UBI9 no-repos[?] | |
❯ ipython | |
Python 3.13.2 (main, Feb 4 2025, 00:00:00) [GCC 14.2.1 20250110 (Red Hat 14.2.1-7)] | |
Type 'copyright', 'credits' or 'license' for more information | |
IPython 8.31.0 -- An enhanced Interactive Python. Type '?' for help. | |
In [1]: import subprocess | |
In [2]: result = subprocess.run("docker build -t ch-d:ubi8 .".split(), capture_output=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import pathlib | |
import random | |
import sys | |
import time | |
# Define the list of names | |
names = ['stephen', 'justin', 'jake', 'david', 'cole', 'tasos', 'brian', 'danny', 'sam', 'griffin', 'mayuri', 'sudhir'] | |
# Create a list of weights that decreases logarithmically as you move through the list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import attr | |
@attr.s() | |
class LinearRegression(): | |
data_points = attr.ib() | |
def __attrs_post_init__(self): | |
self._learn_data() | |
def _learn_data(self, data_points=None): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SPMHelper: | |
def __init__(self, **vars): | |
if not vars: | |
vars = {k: v for k,v in globals().items() if not k.startswith("_")} | |
self.__dict__.update(vars) | |
# usage - pulls in all global-level variables | |
vars = SPMHelper() | |
vars.some_variable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Some utilities for scraping Satellite production logs""" | |
import argparse | |
from pathlib import Path | |
def log_to_dicts(log_path): | |
"""Convert a Satellite log file to a list of dict log entries""" | |
dict_list = [] | |
log_entry = {} | |
current_group = "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
import json | |
from datetime import datetime, timedelta | |
from pathlib import Path | |
class Tracker: | |
def __init__(self): | |
self._td_total = timedelta() | |
self._count = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from requests.exceptions import HTTPError | |
from nailgun import entities | |
from nailgun.entity_mixins import EntitySearchMixin | |
from nailgun.config import ServerConfig | |
import json | |
import yaml | |
ServerConfig(url="<satellite url>", auth=("admin", "<passowrd>"), verify=False).save() | |
def search_entity(ent, **kwargs): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import yaml | |
import logging as real_logger | |
class ParallelLogger: | |
def __init__(self, output_file=None, verbose=False): | |
self.data = [] | |
self._output_set = False | |
self.set_file(output_file) | |
self.verbose = verbose |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import time | |
import random | |
# ['test_cli.py', 'sub-command', '--option1', '17', '--test-flag'] | |
# fix --test-case 0971v2s983a123-sad3t13rg-re36570-4563 --auto-merge | |
# close --test-case | |
# yolo --420 |
NewerOlder