Skip to content

Instantly share code, notes, and snippets.

View ssato's full-sized avatar

Satoru SATOH ssato

View GitHub Profile
@ssato
ssato / anyconfig_cli example to modify the content of YAML file
Last active January 31, 2019 06:16
anyconfig_cli example to modify the content of YAML file
ssato@x1-carbon-gen6% anyconfig_cli -h | grep -A 20 -E \^Query
Query/Get/set options:
-Q QUERY, --query QUERY
Query with JMESPath expression language. See
http://jmespath.org for more about JMESPath
expression. This option is not used with --get option
at the same time. Please note that python module to
support JMESPath expression
(https://pypi.python.org/pypi/jmespath/) is required
to use this option
@ssato
ssato / collect_tower-cli_help_texts.sh.txt
Created August 27, 2018 18:58
The log of 'collect_tower-cli_help_texts.sh' run
ssato@localhost% time bash -x ./autoinstall.d/data/awx/3/collect_tower-cli_help_texts.sh | tee /tmp/collect_tower-cli_help_texts.sh.txt
# tower-cli --help
Usage: tower-cli [OPTIONS] COMMAND [ARGS]...
Options:
--version Display tower-cli version.
--help Show this message and exit.
Commands:
config Read or write tower-cli configuration.
@ssato
ssato / systemd-svc-mon.sh
Last active May 29, 2018 10:25
A sample script to monitor systemd service units forever.
#! /bin/bash
#
# A sample script to monitor systemd service units forever.
#
# Requirements: timeout and sleep in coreutils, uuidgen in utl-linux and systemd
#
# Author: Satoru SATOH <ssato@redhat.com>
# License: MIT
#
set -e
#! /bin/bash
#
# Based on some scripts found at https://ubuntuforums.org/showthread.php?t=1813001
#
# Requirements: espeak and play (sox)
#
# Examples:
#   - cat /etc/issue | $0
#   - echo 'Danger, Robinson!' | $0
#   - rpm -qa --qf "%{n}\n" | sort | unqi | $0
@ssato
ssato / auto_detect_os_and_dist_w_using_osinfo-db
Created April 11, 2017 03:29
Auto detect os and distribution w/ using osinfo-db
$ ipython
Python 2.7.13 (default, Jan 12 2017, 17:59:37)
Type "copyright", "credits" or "license" for more information.
IPython 3.2.1 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [13]: sys.modules["yaml"] = None
In [14]: import anyconfig.backends
In [15]: anyconfig.backends.list_types()
Out[15]:
['bson',
'configobj',
'ini',
'json',
@ssato
ssato / dnf-plugin-tracer-sample-log.txt
Created June 14, 2016 06:50
Sample output log of DNF tracer plugin
You should restart:
* Some applications using:
pulseaudio --kill; pulseaudio --start
* These applications manually:
(sd-pam)
Xorg
evolution-addressbook-factory
evolution-addressbook-factory-subprocess
evolution-calendar-factory
@ssato
ssato / dnf-report-plugin-output-sample-log.txt
Created June 8, 2016 01:45
dnf-report-plugin.py の実行例 (dnf-report-plugin.py を /usr/lib/python3.4/site-packages/dnf-plugins に入れて dnf install ... 実行)
ssato@x1carbon% sudo dnf install nano
Last metadata expiration check: 0:13:55 ago on Tue Jun 7 19:51:00 2016.
Dependencies resolved.
{
"install": [
{
"arch": "x86_64",
"name": "nano",
"release": "3.fc23",
"naevr": "nano.x86_64 0:2.4.2-3.fc23",
@ssato
ssato / dnf-report-plugin.py
Created June 8, 2016 01:27
An experimental DNF plugin to report statistics and changes will be made instead of performing actual operations like install/update/erase/etc.
# report.py
# DNF Plugin to report summary of RPMs to install, update and remove.
#
# It implicitly assume the come back of --enableplugin option to dnf although
# it was removed as 'it's questionalbe use':
# http://dnf.readthedocs.io/en/latest/cli_vs_yum.html#enableplugin-not-recognized
#
# Copyright (C) 2016 Satoru SATOH <satoru.satoh@gmail.com>
#
# This copyrighted material is made available to anyone wishing to use,
@ssato
ssato / compute-holidays-fy16-17.txt
Created May 12, 2016 10:34
国民の祝日を計算してみるテスト
ssato@x1carbon% ipython
Python 2.7.11 (default, Mar 31 2016, 20:46:51)
Type "copyright", "credits" or "license" for more information.
IPython 3.2.1 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.