Skip to content

Instantly share code, notes, and snippets.

View krohne's full-sized avatar

Gregory Krohne krohne

  • Atlanta, Georgia, USA
View GitHub Profile
@krohne
krohne / update_ip.sh
Last active January 28, 2019 19:05
Update ~/.ssh/config IP addresses for preprod and production
#!/bin/bash
# production|preprod
command -v jq >/dev/null 2>&1 || { echo >&2 "I require jq but it's not installed. Try 'brew install jq' Aborting."; exit 1; }
command -v curl >/dev/null 2>&1 || { echo >&2 "I require curl but it's not installed. Try 'brew install curl' Aborting."; exit 1; }
command -v perl >/dev/null 2>&1 || { echo >&2 "I require perl but it's not installed. Try 'brew install perl' Aborting."; exit 1; }
command -v tr >/dev/null 2>&1 || { echo >&2 "I require tr but it's not installed.' Aborting."; exit 1; }
case $1 in
production|preprod)
platform=$1
;;
@krohne
krohne / kill_sophos.sh
Created January 28, 2019 15:29
Remove Sophos from Mac without tamper protection password
#!/bin/bash
# https://gist.github.com/lukebussey/70fe3b245c7b55fa41300670d2698e54#gistcomment-2636296
sudo rm -R /Library/Sophos\ Anti-Virus/
sudo rm -R /Library/Application\ Support/Sophos/
sudo rm -R /Library/Preferences/com.sophos.*
sudo rm /Library/LaunchDaemons/com.sophos.*
sudo rm /Library/LaunchAgents/com.sophos.*
sudo rm -R /Library/Extensions/Sophos*
sudo rm -R /Library/Caches/com.sophos.*
~/Applications/Remove\ Sophos\ Endpoint
@krohne
krohne / unique_objects.js
Created January 9, 2020 18:00
Eliminate duplicate array objects
const arr = [
{ id: 1, val: 'a' },
{ id: 2, val: 'b' },
{ id: 1, val: 'a' },
{ id: 1, val: 'c' }
];
const uni = arr
.reduce( ( unique, item ) =>
unique.some( existing =>
@krohne
krohne / MutiString.pipe.ts
Created October 25, 2021 16:28
Angular pipe to trim and contatenate strings with space between. Mostly for formatting names, which may include null/undefined values, or leading/trailing spaces
// MultiString.pipe.ts
import {
Pipe,
PipeTransform
} from '@angular/core';
@Pipe({ name: 'multiString' })
export class MultiStringPipe implements PipeTransform {
function transform(...values: string[]): string {
return values
@krohne
krohne / get-form-validation-errors.ts
Last active October 11, 2023 14:13 — forked from JohannesHoppe/get-form-validation-errors.ts
Get all validation errors for Angular FormGroup, FormRecord, or FormArray
import {
FormGroup,
FormRecord,
FormArray,
ValidationErrors
} from '@angular/forms';
export function getFormValidationErrors(form: FormGroup|FormRecord|FormArray, path ?: string = '$') {
const result = [];
@krohne
krohne / tmp-cleanup.js
Created April 18, 2025 14:51
Cognizant Talent Market Place - temporarily remove unneeded content
/* Create a bookmark in your Bookmarks Bar. Name it something like "TMP clean up" */
/* Paste this code snippet into the URL field */
javascript: (() => {
[
"dashboard-profile-wrapper cil-wrapper", /* scrolling banner reminder */
"maintenancemessage", /* keep-your-profile-updated reminder */
"welcome-msg-wrapper", /* profile-last-updated + aging + rotation-eligible block */
"ls_dynamic_div", /* help button */
].forEach((id) => {
var elem = document.getElementById(id);