Skip to content

Instantly share code, notes, and snippets.

View samdoran's full-sized avatar

Sam Doran samdoran

View GitHub Profile
@samdoran
samdoran / update-refs.py
Last active February 10, 2025 09:27
List all tags for an image or update references in a file
#!/usr/bin/env python
import argparse
import urllib.request
import json
import sys
import textwrap
import typing as t
from operator import itemgetter
@samdoran
samdoran / save-tasmota-firmware.py
Created December 11, 2024 04:59
Save and organize Tasmota firmware
#!/usr/bin/env python
import argparse
import gzip
import shutil
import sys
from pathlib import Path
@samdoran
samdoran / bake.py
Created November 21, 2024 05:45
Save a container with baked data
#!/usr/bin/env python
from __future__ import annotations
import argparse
import subprocess
import sys
import time
@samdoran
samdoran / diff.patch
Last active April 7, 2023 21:41
Refactoring `get_months_in_date_range`
diff --git koku/api/test_utils.py koku/api/test_utils.py
index 960f4653..daf3c376 100644
--- koku/api/test_utils.py
+++ koku/api/test_utils.py
@@ -290,12 +290,10 @@ class GetMonthsInDateRangeTest(unittest.TestCase):
self.early_start_date = datetime.datetime(2022, 4, 3, tzinfo=pytz.UTC)
self.early_end_date = datetime.datetime(2022, 4, 12, tzinfo=pytz.UTC)
- @patch("api.utils.DateAccessor.today")
@patch("api.utils.DateHelper.today", new_callable=PropertyMock)
@samdoran
samdoran / switch-to-new-coverage-uploader.py
Created November 10, 2021 22:48
Modify a collection to use the new coverage uploader
#!/usr/bin/env python
# Modify a collection to use the new coverage uploader
import argparse
import pathlib
import shutil
import sys
import urllib.request
@samdoran
samdoran / aerohive.md
Last active February 5, 2025 21:55
Configuring Aerohive access points using the CLI

Aerohive

Initial setup

  1. Reset to factory defaults

     reset config bootstrap
     reset config
    

    The username is admin and the password is aerohive or Aerohive1.

@samdoran
samdoran / sshpass.rb
Created September 3, 2021 23:06
Homebrew sshpass formula
require 'formula'
class Sshpass < Formula
url 'http://sourceforge.net/projects/sshpass/files/sshpass/1.06/sshpass-1.06.tar.gz'
homepage 'http://sourceforge.net/projects/sshpass'
sha256 'c6324fcee608b99a58f9870157dfa754837f8c48be3df0f5e2f3accf145dee60'
def install
system "./configure", "--disable-debug", "--disable-dependency-tracking",
"--prefix=#{prefix}"
@samdoran
samdoran / mask.yml
Created October 30, 2020 17:11
systemd mask tests
tasks:
- name: Install chrony
dnf:
name: chrony
state: present
- name: Start, enable, and unmask
systemd:
name: chronyd
state: started
@samdoran
samdoran / test_date_time.py
Last active December 22, 2021 23:59
date_time unit tests
# -*- coding: utf-8 -*-
# Copyright (c) 2020 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import pytest
import datetime
@samdoran
samdoran / systemd_default.py
Last active September 27, 2024 01:32
Ansible module to set systemd default target
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2020 Sam Doran
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = """