Skip to content

Instantly share code, notes, and snippets.

@konrness
konrness / manifest.yaml
Last active February 24, 2023 20:04
Harness K8s Manifests
{{- if .Values.createNamespace}}
apiVersion: v1
kind: Namespace
metadata:
name: {{.Values.namespace}}
---
{{- end}}
apiVersion: apps/v1
kind: Deployment
@konrness
konrness / thycotic-api-query.sh
Last active January 17, 2023 21:15
Example of Querying the Thycotic Secret Server via Harness Custom Secret Manager script
access_token=$(curl -s --location --request POST 'https://<+secretManager.environmentVariables.hostname>/oauth2/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'username=<+secrets.getValue("thycoticUsername")>' \
--data-urlencode 'password=<+secrets.getValue("thycoticPassword")>' \
--data-urlencode 'grant_type=password' | jq -r '.access_token')
secret=$(curl -s --location --request GET 'https://<+secretManager.environmentVariables.hostname>/api/v2/secrets/<+secretManager.environmentVariables.key>' \
--header "Authorization: Bearer $access_token" | jq -r '.items[] | select(.isPassword == true) | .itemValue')
@konrness
konrness / logChanges.js
Created January 31, 2017 20:51
Generate a log of all cell changes, across all sheets, in a Google Spreadsheet Revision History page.
/**
* This script is intended to be run in the Chrome developer console when viewing a Google Spreadsheet in Revision History mode.
* It will iterate through each sheet in the spreadsheet, looking for changed cells, and will log the cells that changed.
*
* Steps to Use:
* 1) Load Google Spreadsheet, click File -> Revision History
* 2) Select the revision you wish to log in the right column
* 3) Open the Developer Tools console and go to the Console tab.
* 4) Paste the following code into the console.
* 5) Run the function in the console: logChanges();
@konrness
konrness / ArrayCombineKeysTest.php
Last active August 31, 2015 21:01
Nerdery PHP Challenge Yourselph - 017 An Array Problem
<?php
require_once 'array_combine_keys.php';
class ArrayCombineKeysTest extends PHPUnit_Framework_TestCase
{
public function testExample()
{
$input = array('apples', 'oranges', 'bananas');
$expectedOutput = array('apples' => 'apples', 'oranges' => 'oranges', 'bananas' => 'bananas');
@konrness
konrness / kness.php
Created August 11, 2015 16:39
Nerdery PHP - Challenge Yourselph - Issue 015: Longest Word
<?php
/**
* Challenge Yourselph - 015
*
* Longest Word
*
* Usage: php kness.php [input]
* Example: php kness.php "I like cheese a lot"
*
* If [input] is omitted, tests are run.
@konrness
konrness / BasicForm.php
Created June 19, 2013 18:27
Adding aria-labelledby attributes to the errors of a form eelement.
$this->addElement(
$this->createElement('password', 'mypassword')
->setLabel('My Password')
->setRequired(true)
);
$this->getElement('mypassword')
->getDecorator('errors')
->setOption('aria-labelledby', 'mypassword');
/**#@+
* Encoding type constants
*/
const ENCTYPE_URLENCODED = 'application/x-www-form-urlencoded';
const ENCTYPE_MULTIPART = 'multipart/form-data';
/**#@-*/
@konrness
konrness / README
Created December 10, 2009 06:00 — forked from karbassi/README
The following Javascript finds the highest z-index in the page and changes the
background color to orange.
What I'm trying to do is find the DOM element with the highest z-index. I have
the following code, but I can't figure out how to do it without having the variable "high".
Can you figure out a better way?
Also, it doesn't seem to work in Safari.