Skip to content

Instantly share code, notes, and snippets.

View djfarrelly's full-sized avatar
🌞

Dan Farrelly djfarrelly

🌞
View GitHub Profile
FROM alpine:3.3
ADD logger.sh /logger.sh
RUN chmod +x /logger.sh
CMD /bin/sh -c "/logger.sh"
@djfarrelly
djfarrelly / .hyperterm.js
Last active September 19, 2016 20:58
Personal HyperTerm perfs
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 16,
// font family with optional fallbacks
fontFamily: '"Droid Sans Mono For Powerline", "Roboto Mono", Menlo, "DejaVu Sans Mono", "Lucida Console", monospace',
// terminal cursor background color (hex)
// cursorColor: '#F81CE5',
@djfarrelly
djfarrelly / index.js
Last active April 22, 2017 18:10
requirebin sketch
const logger = (t) => (document.body.innerHTML = `${document.body.innerHTML}<br>${JSON.stringify(t)}`)
/// app
const { createStore, combineReducers } = require('redux')
const OPEN_COMPOSER = 'OPEN_COMPOSER'
const CLOSE_COMPOSER = 'CLOSE_COMPOSER'
// The metrics reducer - we just grab the even and let the state pass through
const bufferMetrics = (state = {}, action) => {
@djfarrelly
djfarrelly / MongoIdShim.php
Created April 5, 2018 22:13
mongo to mongodb php driver migration helpers
<?php
class MongoId implements Serializable, JsonSerializable
{
public $id;
public function __construct($id)
{
$this->id = (string) $id;
}
@djfarrelly
djfarrelly / 1-regular-probes.yaml
Last active August 31, 2018 19:37
Reply Server liveness and readiness probes
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: respond-server
namespace: reply
spec:
replicas: 12
strategy:
rollingUpdate:
maxSurge: 2
@djfarrelly
djfarrelly / folders.sh
Last active April 5, 2019 20:08
maildev folder structure
# 3 package approach
/maildev-smtp
/src # most of what currently is in /lib
/test
/index.js
/package.json
/maildev-ui
/src # all the react components, etc.
/public
/package.json
@djfarrelly
djfarrelly / local-deploy.sh
Last active July 12, 2019 16:08
How to test your helm chart values yaml files locally
#!/bin/bash
# Usage `./local-deploy.sh <command> <service-name>
# Requirements: helm must be installed and match the version on our cluster
# commands:
# deploy Deploys the code to the cluster (requires cluster access)
# dry-run Prints the k8s deployment and service yaml files generates by helm
CMD="$1"
SVC="$2"
@djfarrelly
djfarrelly / index.ts
Created October 26, 2022 17:32
Inngest Cloudflare Workers Support (w/ inngest@v0.6.1)
import { createFunction } from "inngest"; // v0.6.1
import { serve } from "inngest/cloudflare";
/**
* Inngest serve requires "node_compat = true" to be set in your wrangler.toml
*
* Set INNGEST_SIGNING_KEY in your wrangler.toml environment variables.
* Get this key in your Inngest dashboard: https://app.inngest.com/secrets
*/
@djfarrelly
djfarrelly / encryption-middleware.ts
Created September 22, 2023 19:52
Inngest - Encryption middleware
import { InngestMiddleware } from "inngest";
export const encryptionMiddleware = (
key: string = process.env.INNGEST_ENCRYPTION_KEY || ""
) => {
if (!key) {
throw new Error("Must provide an encryption key");
}
const prefix = "__ENCRYPTED__";
@djfarrelly
djfarrelly / inngest-client.ts
Last active January 11, 2024 17:47
Inngest SDK: Using middleware to access search params from request
import { type NextRequest } from 'next/server';
import { Inngest, InngestMiddleware } from 'inngest';
import { schemas } from './types';
export const searchParamsMiddleware = new InngestMiddleware({
name: 'query-params-pass-through',
init({}) {
return {
onFunctionRun() {
return {