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 os | |
from datetime import datetime | |
import json | |
import uuid | |
TIME_FORMAT="%Y-%m-%d_%H%M%S_%f" | |
FILE_NAME_FORMAT="%(now)s-%(host)s.json" | |
MSG_FORMAT='{"host":"%(host)s","timestamp":"%(now)s", "category":"%(category)s", "data": %(data)s}' + "\n" | |
LOG_DIR="/tmp/ansible/events" | |
AGGREGATION_KEY = uuid.uuid4().hex |
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
#!/usr/bin/env ruby | |
require 'json' | |
require 'csv' | |
unless ARGV.first | |
puts "Usage: HAMMER_USER=admin HAMMER_PASSWORD=changeme rex_outputs.rb JOB_INVOCATION_ID" | |
exit 1 | |
else | |
@job_invocation_id = ARGV.first | |
end |
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
#!/usr/bin/env bash | |
function export-csv () { | |
echo "Exporting $2" | |
echo "COPY ($1) TO STDOUT WITH CSV;" | su - postgres -c '/usr/bin/psql -d foreman' > $2 | |
} | |
function import-csv () { | |
echo "Importing $2" | |
su - postgres -c "/usr/bin/psql -d $IMPORT_DATABASE -c 'COPY $1 FROM STDIN WITH CSV'" <$2 |
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
#!/usr/bin/env sh | |
i3lock -i ~/.config/i3/lock_screen.png |
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
commit 13c25907e7c750eb1f4e19508e6e7aa528dd2f3a | |
Author: root <root@provisioning.sysmgmt.lan> | |
Date: Fri Oct 19 16:47:55 2018 +0200 | |
add more logging | |
diff --git a/lib/restclient.rb b/lib/restclient.rb | |
index bdb53f0..588318b 100644 | |
--- a/lib/restclient.rb | |
+++ b/lib/restclient.rb |
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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'nokogiri' | |
require 'set' | |
require 'yaml' | |
require 'time' | |
# Usage: | |
# | |
# # run inside a directory with extracted task export |
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
./test_args.sh "one two" three | |
with $* | |
["one", "two", "three"] | |
with "$@" | |
["one two", "three"] |
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
# WARNING: for testing only: don't apply to production without testing. | |
# A set of workaround patches to use different hash algorithm in Foreman and log the usage instead of failing right away. | |
# https://bugzilla.redhat.com/show_bug.cgi?id=1552159#c5 | |
function puppet-certs { | |
if grep empty-password /usr/share/katello-installer-base/modules/certs/manifests/ssltools/nssdb.pp | |
then | |
echo "Puppet - certs already patched" | |
return |
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
cat <<EOF | foreman-rake console | |
conf.return_format = "" | |
batch_size = 1000 | |
persistence = ForemanTasks.dynflow.world.persistence | |
adapter = persistence.adapter | |
plans_without_tasks = adapter.db.fetch("select dynflow_execution_plans.uuid from dynflow_execution_plans left join foreman_tasks_tasks on (dynflow_execution_plans.uuid = foreman_tasks_tasks.external_id) where foreman_tasks_tasks.id IS NULL") | |
deleted = 0 | |
total = plans_without_tasks.count | |
plans_without_tasks.all.map{|x| x[:uuid]}.in_groups_of(batch_size, false).each do |uuids| | |
delete_count = persistence.delete_execution_plans({ 'uuid' => uuids }, batch_size) |
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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'nokogiri' | |
# Usage: | |
# | |
# # extract the data to csv | |
# ruby tasks-action-times.rb my-tasks-export/*.html > action_times.csv | |
# | |
# # get top 20 actions with the highest execution time: |
NewerOlder