Skip to content

Instantly share code, notes, and snippets.


Toshio Kuratomi abadger

View GitHub Profile
View gist:b590e8a9ed5900a93d8e5c0bab0de22c
In your classroom, you have ten students that are born in a variety of months.
(1) Use sets or frozensets to tell if anyone was born in the summer.
(2) Use sets or frozensets to tell who was born when the school year is not in session.
The summer months are June, July, and August.
The ten students and their birthdays are:
View gist:b6de3f643c2f5fc21bd8941c3a3bdf37
Given a list of numbers that I will give you, loop through the list and
if it is even, add two to it. If it is odd, multiply it by two. Then
return the new list of numbers to me to use in my program.
View gist:b3103a4c3d5bb82b52590def7f0eadc9
Write a small program that uses "string.format() to print a greeting card message to all the following people:
Here is a snippet from a log file:
abadger / gist:e3d0a7902425efa1224211778adae7e0
Created Sep 23, 2022
Collections added to the ansible tarball after the inclusion criteria were available
View gist:e3d0a7902425efa1224211778adae7e0
2.10.0a1 => 2.10
abadger / gist:f516f167a572231fa2a8bc5efec70c36
Created Aug 23, 2022
toggle vim for copy and paste (using snake)
View gist:f516f167a572231fa2a8bc5efec70c36
@snake.key_map("<c-p>", mode=snake.INSERT_MODE)
def toggle_gutters_insert():
"""Turn the gutters off in insert mode to make mouse selection easier"""
line_no_value = snake.get_option('nu')
signcolumn_value = snake.get_option('signcolumn')
if signcolumn_value != 'no' or line_no_value != '0':
abadger / gist:4448b01107da3bfbe0ebf2a5f383ad81
Created Aug 8, 2022
Possible fix for python-2.6's pytest
View gist:4448b01107da3bfbe0ebf2a5f383ad81
[root@c2r-20220808100827 convert2rhel]# git diff
diff --git a/convert2rhel/unit_tests/ b/convert2rhel/unit_tests/
index d608201..3652831 100644
--- a/convert2rhel/unit_tests/
+++ b/convert2rhel/unit_tests/
@@ -118,7 +118,11 @@ def system_cert_with_target_path(monkeypatch, tmpdir, request):
- mark = request.node.get_closest_marker("cert_filename")
abadger / gist:2e6c53fb524d1a5f4a01109ce4e1c184
Created Aug 8, 2022
full pytest testcase using get_marker on older pytest.
View gist:2e6c53fb524d1a5f4a01109ce4e1c184
import pytest
def system_cert_with_target_path(request):
if pytest.__version__.split('.') <= ('3', '6', '0'):
mark = request.node.get_marker("cert_filename")
View gist:3b7a1cb42ae736cc9f25145969812817
diff --git a/convert2rhel/unit_tests/ b/convert2rhel/unit_tests/
index 40ccf0b..acdd1d1 100644
--- a/convert2rhel/unit_tests/
+++ b/convert2rhel/unit_tests/
@@ -82,8 +82,11 @@ def system_cert_with_target_path(monkeypatch, tmpdir, request):
.. seealso::
+ if pytest.__version__.split('.') <= ('3', '6', '0'):
+ mark = request.node.get_marker("cert_filename")
abadger / gist:ea56e68798d792853315096017307077
Created Jul 8, 2022
Get some introspected info from objects. This is only prof-of-concept level code. Good for a one-off but needs work if you want it in production.
View gist:ea56e68798d792853315096017307077
def obj_inspector(obj):
attributes = {}
functions = {}
special_functions = {}
for attribute_name in dir(obj):
attribute_value = getattr(obj, attribute_name)
attribute_category = attributes
View gist:9ab0c86a6f6a371ea4b800c99e178130
diff --git a/tests/integration/tier0/check-cve-2022-1662/main.fmf b/tests/integration/tier0/check-cve-2022-1662/main.fmf
index 7da180d..bf7c36b 100644
--- a/tests/integration/tier0/check-cve-2022-1662/main.fmf
+++ b/tests/integration/tier0/check-cve-2022-1662/main.fmf
@@ -3,4 +3,6 @@ summary: check cve-2022-1662 is fixed
tier: 0
test: |
+ yum install -y python3-devel
+ pip install psutil