Skip to content

Instantly share code, notes, and snippets.

View ekohl's full-sized avatar

Ewoud Kohl van Wijngaarden ekohl

View GitHub Profile
@ekohl
ekohl / gitconfig
Last active November 18, 2020 14:05
[alias]
ph = "!git push $(whoami) HEAD --set-upstream --quiet"
pr = "!hub pull-request"
phr = "!git ph && git pr"
[url "git@github.com:theforeman/"]
pushInsteadOf = "ghf:"
[url "https://github.com/theforeman/"]
insteadOf = "ghf:"
$ cat modules/puppet-*/metadata.json | jq '.operatingsystem_support[].operatingsystem' | sort | uniq -c | sort -h
jq: error (at <stdin>:120): Cannot iterate over null (null)
jq: error (at <stdin>:1725): Cannot iterate over null (null)
jq: error (at <stdin>:2048): Cannot iterate over null (null)
jq: error (at <stdin>:5360): Cannot iterate over null (null)
1 "CloudLinux"
1 "Darwin"
1 "DragonFly"
1 "NetBSD"
1 "PCS"
#!/usr/bin/env ruby
require 'librarian/puppet'
librarian_environment = Librarian::Puppet::Environment.new(pwd: 'Puppetfile.lock')
librarian_environment.lock.manifests.sort_by { |manifest| manifest.name.split('-').last }.each do |manifest|
puts "#{manifest.name.split('-').last} #{manifest.version}"
end
@ekohl
ekohl / defaults.json
Created June 25, 2019 17:47
test_pages.py
{
"username": "admin",
"password": "changeme",
"name": "Admin User"
}
@ekohl
ekohl / tiers.py
Last active June 13, 2019 08:27
A script to determine tiers
#!/usr/bin/env python3
# Requires Python 3.7 for dataclasses
import argparse
import json
from dataclasses import dataclass
@dataclass(eq=True, frozen=True, order=True)
@ekohl
ekohl / fp-curl
Created May 17, 2019 14:46
A script that wraps curl with the right connection details
#!/usr/bin/env ruby
#
# This script wraps curl with the right connection details so you don't need to
# care about it.
#
# The first argument is the path on the host, including the first slash:
#
# ./fp-curl /features
# ./fp-curl /v2/features | jq .
# ./fp-curl /puppet/ca/host.example.com -X DELETE
@ekohl
ekohl / module-versions
Created April 2, 2019 17:40
Show puppet module versions
#!/usr/bin/env ruby
require 'librarian/puppet'
librarian_environment = Librarian::Puppet::Environment.new(pwd: 'Puppetfile.lock')
librarian_environment.lock.manifests.sort_by { |manifest| manifest.name.split('-').last }.each do |manifest|
author, name = manifest.name.split('-')
if ['theforeman', 'katello'].include?(author)
branch = "#{manifest.version.to_s.split('.')[0..1].join('.')}-stable"
puts "puppet-#{name} #{branch} #{manifest.version}"
#!/bin/bash -e
PACKAGE="$1"
SOURCE_DIR="${2:-${HOME}/dev/${PACKAGE}}"
if [[ -z $PACKAGE ]] ; then
echo "Usage: $0 PACKAGE"
exit 1
fi
@ekohl
ekohl / example
Last active April 10, 2019 10:33
get_package_names
$ ./get_package_names foreman-release
foreman-nightly-nonscl-rhel7 foreman-release-1.22.0-0.1.develop.el7
foreman-client-nightly-rhel5 foreman-release-1.22.0-0.1.develop.el5
foreman-client-nightly-rhel6 foreman-release-1.22.0-0.1.develop.el6
foreman-client-nightly-fedora27 foreman-release-1.22.0-0.1.develop.fc27
foreman-client-nightly-fedora28 foreman-release-1.22.0-0.1.develop.fc28
$ ./get_package_names --dist el7 foreman-release
foreman-nightly-nonscl-rhel7 foreman-release-1.22.0-0.1.develop.el7
$ ./get_package_names foreman-release rubygem-foreman_templates
@ekohl
ekohl / graph.py
Last active December 27, 2018 16:18
Foreman Installer dependencies
#!/usr/bin/env python3
import argparse
import json
def normalize_name(module):
full_name = module.replace('-', '/', 1).lower()
author, name = full_name.split('/', 1)
return name if author in ('theforeman', 'katello') else full_name