Skip to content

Instantly share code, notes, and snippets.

@soofstad
soofstad / searchDMSSExample.py
Last active June 23, 2021 08:33
Example to search the Data Modeling Storage Service for entities using python. Requires Python version >= 3.6
#! /usr/bin/env python3
import pprint
import sys
from typing import Dict
import requests # https://docs.python-requests.org/en/latest/user/quickstart/
print(f"Python version {sys.version}\n")
pretty_printer = pprint.PrettyPrinter()
@soofstad
soofstad / check-puppet-last-run.py
Last active July 16, 2020 11:02
Sensu check for puppet-last-run in native python3
#! /usr/bin/env python3
import argparse
import datetime
parser = argparse.ArgumentParser(description='Check Puppet status')
parser.add_argument('--summary-file', dest='puppet_status',
default="/opt/puppetlabs/puppet/cache/state/last_run_summary.yaml",
help=f"path to the puppet last_run_summary.yaml file. Defaults to '/opt/puppetlabs/puppet/cache/state/last_run_summary.yaml'")
parser.add_argument('--warn-age', type=int, default=3600,
@soofstad
soofstad / github_org_outside_collaborators.py
Last active April 21, 2020 14:34
Python script getting owners of repos with outside collaborators
import csv
import json
from urllib import request
usage = """
------------------------
Usage
------------------------
Add your Github Access Token with "read_user, user:email, public_repo, repo:invite" scopes like so;
token = "ksdjhkglkfjhløaksjbli378gblaup"
@soofstad
soofstad / How to: Equinor private NPM registry.md
Last active January 25, 2020 06:00
How to: Equinor private NPM registry

How to: Equinor private NPM registry

Disclamer: This is just an example on how to do these tasks. You can configure npm/yarn in many ways to make life easier.
Feel free to experiment.

Login

CLI

Requirements: Have a Github account that is a member of the Github organization Equinor

  1. Create a personal access token on Github with the read:org scope
  2. Run npm login --registry https://npm.equinor.com