Skip to content

Instantly share code, notes, and snippets.

View jkuester's full-sized avatar

Joshua Kuestersteffen jkuester

  • Kansas somewhere...
  • 20:32 (UTC -05:00)
View GitHub Profile
#!/bin/sh
# Configuration for the script
POSTFIX_CONFIG=/overrides/postfix.cf
POSTFIX_SASL=/etc/postfix/sasl_passwd
# Set a safe umask
umask 077
# Add the relay host params
@jkuester
jkuester / gist:24588aefd7a3e113f900b3fcaf3f0c97
Last active August 22, 2019 22:13
Fr. Siemes to the Holy See - On the topic of the atomic bombs dropped on Japan
“Some of us consider the bomb in the same category as poison gas and were against its use on a civilian population.
Others were of the opinion that in total war, as carried on in Japan, there was no difference between civilians and
soldiers, and that the bomb itself was an effective force tending to end the bloodshed, warning Japan to surrender and
thus to avoid total destruction. It seems logical that he who supports total war in principle cannot complain of a war
against civilians. The crux of the matter is whether total war in its present form is justifiable, even when it serves a
just purpose. Does it not have material and spiritual evil as its consequences which far exceed whatever good might
result? When will our moralists give us a clear answer to this question?”
@jkuester
jkuester / find_required_notes.sh
Last active November 12, 2021 17:16
Script for finding note fields that have been improperly set to required. Execute the script from the root directory of your config.
#!/usr/bin/env bash
set -Eeuo pipefail
msg() {
echo >&2 -e "${1-}"
}
is_readonly='[^>]*readonly="true\(\)"'
is_string='[^>]*type="string"'
is_required='[^>]*required="true\(\)"'
@jkuester
jkuester / couch.js
Created May 16, 2022 16:30
Script for bulk adding CHT contacts with attachment
/*
To use this script:
- Save this script into a directory
- Include a PNG image in the directory called SamplePNG_1.png
- From within that directory, install nano: `npm install nano`
- Update the constants below to match your desired values
- Run the script: 'node couch.js`
*/
const NUMBER_OF_DOCS = 2;
const STARTING_INDEX = 1; // Update this on subsequent runs to avoid id conflicts when running the script multiple times
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:h="http://www.w3.org/1999/xhtml">
<h:head>
<h:title>Photos on Android - Demo Form</h:title>
<model>
<instance>
<photos-on-android id="159_file_picker">
<my_photo/>
<meta>
<instanceID/>
</meta>
@jkuester
jkuester / alert.js
Created June 14, 2023 14:31
Alert in CHT form with extension-lib
const getValue = function(obj) {
let val;
if (obj.t === 'arr') {
val = obj.v && obj.v.length && obj.v[0];
} else {
val = obj.v;
}
if (!val) {
return '';
@jkuester
jkuester / ped.spec.js
Created June 27, 2023 13:06
PED Performance Test
const { expect } = require('chai');
const TestRunner = require('cht-conf-test-harness');
const harness = new TestRunner();
const ITERATIONS = 10;
const PED_INPUTS = [
[],
[],
Beatrice Alex 1.20
Carl Alex 45
Carl Beatrice 12.50
Alex Beatrice 19.22
Beatrice Carl 67.90
Carl Beatrice 12.80
Carl Alex 15.88
Beatrice Carl 71.42
Beatrice Alex 4.54
Beatrice Carl 28.76
{
"_id": "6b7e8f42-c2f0-494b-b343-ebf83d289587",
"_rev": "1-9c396777743f1e21225cbf8831db22c6",
"form": "non_relevant_inputs",
"type": "data_record",
"content_type": "xml",
"reported_date": 1693502842407,
"contact": {
"_id": "74b386c0-a291-4c8b-8203-0da07a3b0173",
"parent": {
@jkuester
jkuester / No_Effect.ts
Last active January 18, 2024 17:46
Comparison of oct-numbers without/with effect-ts
const CHAR_DICT: Record<string, string> = {
' _ | ||_| ': '0',
' | | ': '1',
' _ _||_ ': '2',
' _ _| _| ': '3',
' |_| | ': '4',
' _ |_ _| ': '5',
' _ |_ |_| ': '6',
' _ | | ': '7',
' _ |_||_| ': '8',