Skip to content

Instantly share code, notes, and snippets.

@MasonM
MasonM / gen_workflow_image.sh
Created February 22, 2025 06:17
Create Argo Workflow status as an image
docker run --network host --init --rm ghcr.io/puppeteer/puppeteer:latest node -e '
import puppeteer from "puppeteer";
const browser = await puppeteer.launch({ args: ["--no-sandbox"] });
const page = await browser.newPage();
await page.setViewport({ width: 200, height: 400 });
await page.goto("http://127.0.0.1:8080/widgets/workflow-graphs/argo");
await page.waitForSelector("svg");
process.stdout.write(await page.screenshot());
await browser.close();
' > screenshot.png
@MasonM
MasonM / very-large-workflow.yaml
Created October 17, 2024 21:14
Very large Argo Workflow
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
creationTimestamp: "2020-06-02T00:26:32Z"
name: retry-with-dags
spec:
entrypoint: retry-with-dags
templates:
-
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
creationTimestamp: "2020-06-02T00:26:32Z"
name: retry-with-dags
spec:
entrypoint: retry-with-dags
templates:
-
@MasonM
MasonM / inject_naver.js
Created June 19, 2019 20:28
Sandboxing Naver pixel
// POC code for injecting the Naver wcslog.js tag inside an iframe sandbox
var iframe = document.createElement('iframe');
iframe.sandbox = 'allow-scripts';
iframe.srcdoc = '<script src="https://wcs.naver.net/wcslog.js" type="text/javascript"><\/script>';
document.body.appendChild(iframe);
@MasonM
MasonM / inject_demandbase.js
Last active June 12, 2019 23:53
Sandboxing Demandbase tag
// POC code for injecting Demandbase inside an iframe sandbox
var iframe = document.createElement('iframe');
iframe.sandbox = 'allow-scripts';
// note: the actual production version of this will probably have a separate HTML file instead of
// "srcdoc" because of browser support issues. This is just for POC purposes.
iframe.srcdoc = '<script src="https://scripts.demandbase.com/qQQxkRp0.min.js" type="text/javascript"><\/script>';
document.body.appendChild(iframe);
@MasonM
MasonM / test_plugin.js
Created April 17, 2019 01:45
Example plugin to override index page
module.exports = {
name() { return 'test_plugin' },
open(context) { this.make = context.messageMaker('test_plugin').make },
processMessage(message, queue) {
if (message.type === 'sitespeedio.setup') {
queue.postMessage(this.make('html.pug', {
id: 'index',
name: 'Overridden index',
pug: "html\n body\n h1 Hello!",
type: 'summary',
@MasonM
MasonM / bucketpolicypermissions.json
Created July 7, 2018 19:54
A Cloud guru missing resource
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": [
"s3:GetObject"
],
#!/bin/bash
yum install httpd php php-mysql -y
yum update -y
chkconfig httpd on
service httpd start
echo "<?php phpinfo(); ?>" > /var/www/html/index.php
cd /var/www/html
wget https://s3.eu-west-2.amazonaws.com/acloudguru-example/connect.php
@MasonM
MasonM / depends.sql
Created March 28, 2018 06:16
depends.sql
SELECT
pg_catalog.pg_get_constraintdef(source_constraint.oid),
source_constraint.conkey,
source_table.relname AS source_table,
source_attribute.attname AS source_attribute,
related_table.relname AS related_table,
related_attribute.attname AS related_attribute
FROM pg_catalog.pg_namespace AS namespace
INNER JOIN pg_catalog.pg_class AS source_table ON (source_table.relnamespace = namespace.oid)
INNER JOIN pg_catalog.pg_attribute AS source_attribute ON (source_attribute.attrelid = source_table.oid)
@MasonM
MasonM / wiremock-admin-api.json
Created February 26, 2018 05:50
Wiremock API spec in OpenAPI 3.0 format
{
"info": {
"title": "WireMock",
"version": "2.15.0"
},
"paths": {
"/__admin/mappings": {
"delete": {
"responses": {
"200": {