Skip to content

Instantly share code, notes, and snippets.

View dobesv's full-sized avatar

Dobes Vandermeer dobesv

View GitHub Profile
@dobesv
dobesv / dev_signed_cert.sh
Last active March 21, 2024 07:47
Script to create (1) a local certificate authority, (2) a host certificate signed by that authority for the hostname of your choice
#!/usr/bin/env bash
#
# Usage: dev_signed_cert.sh HOSTNAME
#
# Creates a CA cert and then generates an SSL certificate signed by that CA for the
# given hostname.
#
# After running this, add the generated dev_cert_ca.cert.pem to the trusted root
# authorities in your browser / client system.
#
import storage, {
AnalyticsStorage,
ANY,
GLOBAL,
} from '@analytics/storage-utils';
export interface ConsentAwareStorage extends AnalyticsStorage {
getConsent(): boolean;
setConsent(newValue: boolean): void;
}
import { CookiePolicyAcceptance } from './CookiePolicyAcceptance';
import getStoredPolicyAcceptance from './getStoredPolicyAcceptance';
export type DataLayerName = 'dataLayer' | 'ga4DataLayer' | 'adwordsDataLayer';
export type GtagName = 'gtag' | 'adwordsGtag' | 'gtmGtag';
export const gtagFn = (
dataLayerName: DataLayerName,
gtagName: GtagName,
): ((..._args: any[]) => any) =>
@dobesv
dobesv / gist:4f76a2095a3aa8bc20eda6b3a8e455b3
Created December 20, 2019 06:11
Example of a kubernetes cron job that dumps a postgres database and copies it to s3
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: postgres-backup
spec:
schedule: "0 12 * * *"
jobTemplate:
spec:
backoffLimit: 0
template:
@dobesv
dobesv / BrowserChooser.desktop
Created March 16, 2023 17:52
Home-made Browser Picker for Linux
[Desktop Entry]
Name=Browser Chooser
GenericName=Browser Chooser
Comment=Choose what browser to use for specific links
Categories=Network;
Exec=browser-chooser %u
Type=Application
MimeType=x-scheme-handler/unknown;x-scheme-handler/about;text/html;text/xml;application/xhtml_xml;x-scheme-handler/http;x-scheme-handler/https;
import storage, {
AnalyticsStorage,
ANY,
GLOBAL,
} from '@analytics/storage-utils';
export interface ConsentStorage extends AnalyticsStorage {
getConsent(): boolean;
setConsent(newValue: boolean): void;
}
@dobesv
dobesv / csvAsyncIterator.ts
Created February 20, 2019 19:43
Async iterator wrapper for papaparse
import Papa, { ParseConfig, Parser } from 'papaparse';
export type CsvAsyncIteratorOptions = Exclude<
ParseConfig,
'step' | 'chunk' | 'complete' | 'error'
>;
/**
* Helper to allow async iteration over the contents of
* a CSV input.
@dobesv
dobesv / es-config.txt
Created July 24, 2019 23:22
Example configuration for fluentd-es namespace per index using record_modifier and elasticsearch
<filter kubernetes.**>
@type kubernetes_metadata
</filter>
# Use tag as index name prefix by default
<filter **>
@type record_modifier
<record>
_es_index ${tag_parts[0]}.${Time.at(time).strftime('%F')}
</record>
@dobesv
dobesv / boorkmarklet.md
Last active November 8, 2021 19:44 — forked from 71/boorkmarklet.md
Lists all participants in a Google Meet meeting.

The following bookmarket shows a popup with the name of the participants separated by newlines.

javascript:-function(maxStrLength = 2000) { try { function findParticipants(current, depth = 0) { if (depth > 7) return; if (typeof current !== "object" || current === null || current === window) return; const descriptors = Object.getOwnPropertyDescriptors(current); for (const prop in descriptors) { if (prop.startsWith('["spaces/')) return Object.values(current); const item = findParticipants(descriptors[prop].value, depth + 1); if (item !== undefined) return item; } } const rootState = Object.entries(window).find(x => x[0].startsWith("closure_lm_"))[1], participants = findParticipants(rootState), names = []; function findName(obj) { for (const prop in obj) { const value = obj[prop]; if (typeof value === "object" && value !== null && typeof value[1] === "string") return value[1]; } } for (let i = 0; i < participants.length; i++) { const name = findName(participants[i]); if (names.indexOf(name) === -1) names.
@dobesv
dobesv / machine.js
Last active September 28, 2021 00:31
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions