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

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 / 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 / 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 / gist:446b041b6a388cb6a769
Last active August 29, 2015 14:25 — forked from simonmorley/gist:d16261a1b45e28af6455
Google Cloud Compute Create Snapshot with Rotate
#!/bin/ruby
require 'json'
require 'time'
require 'syslog'
class Snapshot
def initialize()
@format = 'json'
@dynajoe
dynajoe / index.html
Created December 26, 2014 06:19
Same Game in HTML
<html>
<head>
<script type="text/javascript">
window.onload = function () {
var canvas = document.getElementById('game-canvas');
var context = canvas.getContext("2d");
context.fillStyle = "#0000FF";
var radius = 30;
var x = 250;