Skip to content

Instantly share code, notes, and snippets.

View intolerance's full-sized avatar
👋
while(1 < 2) { aG.work(); }

Allen Gammel intolerance

👋
while(1 < 2) { aG.work(); }
View GitHub Profile
@intolerance
intolerance / netmask.js
Last active October 17, 2018 19:20
Netmask for IP traversing
import { Netmask } from 'netmask';
const block = new Netmask('192.168.150.0/21'); // 21 === 255.255.248.0 subnet
console.log(block.mask);
block.forEach(comp => {
console.log(comp);
});
@intolerance
intolerance / MongoRemoveDupes.js
Last active November 6, 2019 21:12
Finds and remove duplicates from MongoDB without aggregation
const devs = {};
Device.find({}, (err, devices) => {
devices.forEach((device) => {
if (!devs || !devs[device.uid]) {
devs[device.uid] = [];
}
devs[device.uid].push(device);
});
const dupesOnly = {};
@intolerance
intolerance / deviceModal.json
Last active September 12, 2019 17:09
Device Modal mock data
{
"uid": "462-1000",
"name": "4900",
"manufacturer": "OKUMA",
"model": "MA600",
"building": "A",
"cell": "INTBODIES",
"location": "Fort Worth",
"coords": {},
"businessUnit": "Pressure Pumping",
@intolerance
intolerance / db-swagger.json
Created October 9, 2019 15:19
paperless-db-swagger
{
"swagger": "2.0",
"info": {
"description": "This is for a mongo API\n",
"version": "1.0.1",
"title": "MongoPaperless",
"contact": {
"email": "taylor.fry@mail.weir"
},
"license": {
@intolerance
intolerance / findScrollTopGreaterThanZero.js
Last active November 6, 2019 21:12
Finds an element whos ScrollTop is greater than 0
var all = document.getElementsByTagName("*"), i = 0;
for (; i < all.length; i++) {
if (all[i].scrollTop !== 0 ){
console.log(all[i]);
}
}
@intolerance
intolerance / paperless-swagger.json
Created November 20, 2019 18:37
Paperless Swagger 1.0.4
{
"openapi" : "3.0.0",
"info" : {
"description" : "This API is used to interact with SyteLine",
"version" : "1.0.4-oas3",
"title" : "Paperless Manufacturing",
"contact" : {
"email" : "allen.gammel@mail.weir"
},
"license" : {
@intolerance
intolerance / GenCSR.sh
Last active November 12, 2020 15:09
OpenSSL -- CSR and PFX
# Using OpenSSL v1.1.1 on MacOS
# Ensure you set the Common Name to *.domain.com for WildCard certificates while entering the information
# !!! Remember the private key (PEM) password -- you will need it later !!!
openssl req -out csr.csr -new -newkey rsa:2048 -keyout privatekey.key
# This command will print out the CSR so you can validate the SANs are there
openssl req -in csr.csr -noout -text

Moving to a new MS Org? (macOS specific)

I recently switched to a new MS Org and was having issues with the Microsoft Login going to my old tenant instead of the new one.

Outlined below are the steps I used to eliminate the old MS Org and allow you to move forward with the new one.

The Purge

  1. Uninstall all Office applications
  2. Uninsall Company Portal application
  3. Open KeyChain

Renew Certificates on K8s

Perform certificate renew

sudo kubeadm alpha certs renew all
sudo cp /etc/kubernetes/admin.conf ~/.kube/config

Copy bottom certificate sections of admin.conf to kubelet.conf