Skip to content

Instantly share code, notes, and snippets.

View carlwgeorge's full-sized avatar

Carl George carlwgeorge

View GitHub Profile
@carlwgeorge
carlwgeorge / cmc.py
Last active January 23, 2025 21:24
script to calculate total weekly CentOS instances
#!/usr/bin/python3
import datetime
import pathlib
import sqlite3
from urllib.request import urlretrieve
import click
import platformdirs
@carlwgeorge
carlwgeorge / gnome.yml
Last active November 15, 2024 02:30
ansible playbook for my gnome setup
# https://docs.ansible.com/ansible/latest/modules/dconf_module.html
#
# To determine what dconf keys and values to use, you can run `dconf watch /`
# in a terminal as you make changes in settings or tweaks. You can also use
# `dconf read <key>` and `dconf write <key> <value>` to experiment with various
# settings. The dconf-editor application is also useful for exploring various
# keys along with their descriptions.
- hosts: localhost
tasks:
@carlwgeorge
carlwgeorge / repocount.sh
Created September 24, 2024 19:55
script to count the number of packages in a yum repo
#!/usr/bin/bash
set -eou pipefail
# TODO: loop multiple
if [[ $# -ne 1 ]]; then
echo "usage: $(basename $0) <baseurl>"
exit 1
fi
--- zlib-ng.spec 2024-08-28 16:10:30.713794292 -0500
+++ zlib-ng-epel.spec 2024-08-28 16:14:33.850601166 -0500
@@ -1,4 +1,3 @@
-%bcond_without compat
%bcond_without sanitizers
# Be explicit about the soname in order to avoid unintentional changes.
@@ -7,23 +6,17 @@
# A change proposal is needed:
# https://docs.fedoraproject.org/en-US/program_management/changes_policy/
@carlwgeorge
carlwgeorge / removed-in-c10.py
Created August 22, 2024 22:48
list packages that were in CentOS 9 that are not in CentOS 10
#!/usr/bin/python3
import json
from urllib.request import urlopen
def get_pkgs(compose_url):
rpms_url = compose_url + 'compose/metadata/rpms.json'
with urlopen(rpms_url) as response:
data = json.loads(response.read())
@carlwgeorge
carlwgeorge / yum-clean-all-demystified.md
Last active May 16, 2024 05:16
yum clean all demystified

TLDR:

  • yum clean all == clean most
  • rm -rf /car/cache/yum/* == really clean everything

From the man page:

Note that these commands only operate on files in currently enabled
repositories. If you use substitution variables (such as $releasever) in your cachedir configuration, the operation is further restricted to the current
values of those variables.

- hosts: all
vars:
user: carl
uid: 1000
become: true
tasks:
- name: install syncthing
package:
name: syncthing

How I switched from mdadm to btrfs

After reading [this Ars Technica article][1], I decided that I wanted to start using btrfs on my home fileserver. It had been running for a few years with an mdadm raid-10 array, formatted with ext4, holding about 3.4 TB of data. I figured I would take advantage of some of the special capabilities of btrfs to perform the conversion in place. After some research, I formed my basic plan.

  • backup data to external drives
  • remove two of the drives from the mdadm raid-10
  • configure those two drive with a btrfs raid-0 filesystem
  • copy the data from the degraded mdadm raid-10 to the new btrfs raid-0
  • completely deactivate the mdadm raid-10
#!/usr/bin/python3
import repomd
def count(name, rpms_repo_url, srpms_repo_url):
rpm_count = len(repomd.load(rpms_repo_url))
srpm_count = len(repomd.load(srpms_repo_url))
print(f'{name}: {rpm_count:7,} RPMs {srpm_count:6,} SRPMs')
#!/usr/bin/python3
import repomd
def count(baseurl):
r = repomd.load(baseurl)
print(f'{len(r)} - {baseurl}')