Skip to content

Instantly share code, notes, and snippets.

Avatar

James E. Flemer jflemer-ndp

  • NDP, LLC.
  • Boulder, CO
View GitHub Profile
@jflemer-ndp
jflemer-ndp / checkheader.sh
Last active Oct 5, 2020
Check a c/c++ header by itself
View checkheader.sh
#!/bin/sh
##############################################################################
# Test a C/C++ header file for standalone validity. This will help show if
# there are missing/implicit headers etc.
#
# Usage
# -----
# checkheader.sh foo.h ...
#
@jflemer-ndp
jflemer-ndp / rpmgpgsign.sh
Created Sep 24, 2020
Wrapper for non-interactive signing of RPMs
View rpmgpgsign.sh
#!/bin/bash
##############################################################################
# Wrapper for non-interactive signing of RPMs.
#
# _NOTE: This uses environment variables for sensitive information (the GPG
# passphrase), so should not be used on an untrusted or shared host._
#
# Prep
# ----
View testrepocert.sh
#!/bin/bash
# test each redhat subscription key against a given (repo) url
if [ -z "$1" ]; then
echo "usage: $0 <url>"
echo ""
echo "example:"
echo " $0 'https://cdn.redhat.com/content/dist/rhel/server/7/\$releasever/\$basearch/os/repodata/repomd.xml'"
exit 1
@jflemer-ndp
jflemer-ndp / unload-nouveau.sh
Created Oct 20, 2019
Unload the nouveau driver
View unload-nouveau.sh
#!/bin/sh
#
# Try very hard to unload Nouveau driver. Tested on RHEL 7.7 in a
# systemd context. Run this before trying to install the NVIDIA
# driver.
#
# Inspired by https://gist.github.com/davispuh/84674924dff1db3e7844
#
# ---
#
@jflemer-ndp
jflemer-ndp / createpypirepo.py
Last active Jul 13, 2019
Make a PEP503 simple python pypi repo
View createpypirepo.py
#!/usr/bin/env python
# Copyright 2019, NDP LLC
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
View poise-python_maintainer.eml
Subject: Re: poise-python maintainer
To: James Flemer <james.flemer@ndpgroup.com>
From: Noah Kantrowitz <noah@coderanger.net>
Date: Fri, 12 Jul 2019 12:21:21 -0700
To put it more bluntly: 1) I don't believe you can maintain it 2) I have
no reason to trust you.
It has nothing to do with being an open-source proponent, it's about
responsibility to end users. Sometimes to best thing to do is let things
@jflemer-ndp
jflemer-ndp / IAMUserSelfPasswordAndMFA.json
Created Jun 24, 2019
Amazon AWS GovCloud MFA/2FA enforcement IAM Policy
View IAMUserSelfPasswordAndMFA.json
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowViewAccountInfo",
"Effect": "Allow",
"Action": [
"iam:GetAccountPasswordPolicy",
"iam:GetAccountSummary",
"iam:ListVirtualMFADevices"
@jflemer-ndp
jflemer-ndp / git-rpm-changelog.sh
Last active Mar 18, 2018
generate a rpm spec compatible changelog from git history
View git-rpm-changelog.sh
#!/bin/bash
merge_commit() {
git show --no-patch --format='%P' "$@" | head -1 | grep -q ' '
}
commit_meta() {
git show --no-patch --format="* %cd %aN <%ae> - %H" --date=local "$@" | \
head -1 | \
sed -E 's/^(\* [a-z0-9 ]{9,10}) \d{2}:\d{2}:\d{2}/\1/i'
View check-chef-run.sh
#!/bin/sh
# Copyright 2017, NDP LLC
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
@jflemer-ndp
jflemer-ndp / pps_yum.sh
Last active Dec 2, 2017
Generate markdown software report for yum repos
View pps_yum.sh
#!/bin/sh
# Usage:
# pps_yum.sh /path/to/repo1 ... /path/to/repoN
#
# Example:
# pps_yum.sh /export/repos/rhel-7-* /export/repos/rhel-*-7-* > rhel7_pps.md
# Copyright 2017, NDP LLC
#