Skip to content

Instantly share code, notes, and snippets.

View dynajoe's full-sized avatar

Joe Andaverde dynajoe

  • Temporal Technologies
  • United States
View GitHub Profile
@dynajoe
dynajoe / aws.md
Created June 15, 2022 23:00 — forked from colinvh/aws.md
AWS Region Names

Alternative naming schemes for AWS regions

Purpose

The intent is to define terse, standards-supported names for AWS regions.

Schemes

@dynajoe
dynajoe / kubectl-root-in-host-nopriv.pks.sh
Created June 2, 2021 19:09 — forked from jjo/kubectl-root-in-host-nopriv.sh
Yeah. Get a root shell at any Kubernetes *node* via `privileged: true` + `nsenter` sauce. PodSecurityPolicy will save us. DenyExecOnPrivileged didn't (kubectl-root-in-host-nopriv.sh exploits it)
#!/bin/sh
# Launch a Pod ab-using a hostPath mount to land on a Kubernetes node cluster as root
# without requiring `privileged: true`, in particular can abuse `DenyExecOnPrivileged`
# admission controller.
# Pod command in turn runs a privileged container using node's /var/run/docker.sock.
#
# Tweaked for PKS nodes, which run their docker stuff from different
# /var/vcap/... paths
node=${1}
case "${node}" in
@dynajoe
dynajoe / Program.cs
Created November 1, 2012 16:06
Example C# HTTP Server
using System;
using System.Net;
using System.Text;
using System.Threading;
namespace ExampleSimpleWebserver
{
class Program
{
static void Main (string[] args)

Problem

When scheduling actions to be carried out at a specific time there are a wealth of options. Each option suitable for a very different use case. The aim of this description is to present a use case with requirements and a solution to event scheduling.

Requirements

  1. Scheduled events must be persisted
  2. Events can be cancelled
  3. Events can be rescheduled
  4. Events are easily traceable
@dynajoe
dynajoe / ibeacon.py
Last active December 20, 2018 03:31
ibeacon.py
#!/usr/bin/python
import dbus
import dbus.exceptions
import dbus.mainloop.glib
import dbus.service
import array
import gobject
@dynajoe
dynajoe / Elm.pegjs
Created October 25, 2018 03:10
A PEG.js Grammar for Elm
{
function extractList(list, index) {
return list.map(function(element) { return element[index]; });
}
function buildList(head, tail, index) {
return [head].concat(extractList(tail, index));
}
function optionalList(value) {
@dynajoe
dynajoe / pg_replace_prepared.js
Last active June 26, 2018 20:23
pg_replace_prepared.js
#!/usr/bin/env node
process.stdin.setEncoding('utf8');
var data = '';
process.stdin.on('readable', function() {
var chunk = process.stdin.read();
if (chunk !== null) {
@dynajoe
dynajoe / all_settled.js
Created October 19, 2017 18:49
Example of all settled promises
// This will always return a promise that completes when all promises have completed
// because we're turning errors into successful promises (because .catch does not throw an error)
var allSettled = (promises) => {
return Promise.all(promises.map(p => {
return p.then(result => {
return { result: result, error: null }
})
.catch(error => {
return { result: null, error: error }
})
@dynajoe
dynajoe / generator_dependencies.js
Created June 27, 2016 19:02
Generators + Dependency Resolution
function RequestUserContext() {} // Used to signal request for user
// Understands the request for the user context
function runner(g, user) {
const generator = g()
let result = generator.next()
do {
if (result.value && result.value.constructor == RequestUserContext) {
@dynajoe
dynajoe / mismatch.js
Last active December 20, 2015 12:59
detect name or birth mismatch
var http = require('http');
var modelNames = {'RadExam': 4, 'PathExam': 1, 'LabResult': 8/*, 'Patient': 1*/ };
// var modelNames = {'RadExam': 2, 'PathExam': 2, 'LabResult': 2, 'Patient': 1 };
// var rootUrl = 'illum-qa-india.softek.local:8080/solr/';
var rootUrl = 'illum-index-prod:8080/solr/';
var modelNames = {'RadExam': 4, 'PathExam': 1, 'LabResult': 8, 'Patient': 1 };