Skip to content

Instantly share code, notes, and snippets.

@wyozi
wyozi / cloudsqlProxy.ts
Created April 10, 2021 13:46
Setup Google Cloud SQL Proxy sidecar in Pulumi/Kubernetes with tombstone support
import * as pulumi from '@pulumi/pulumi'
import * as gcp from '@pulumi/gcp'
import * as k8s from '@pulumi/kubernetes'
export class CloudSQLAccount {
readonly serviceAccount: gcp.serviceaccount.Account
readonly serviceAccountKey: gcp.serviceaccount.Key
readonly credentialsSecret: k8s.core.v1.Secret
@wyozi
wyozi / jsonnet.js
Created January 13, 2023 09:52
JSONNet language for codemirror v6
// src https://github.com/google/codemirror-mode-jsonnet
const jsonnet: any = {
token: function (stream, state) {
// Handle special states:
// In a C-style comment
if (state.cComment) {
if (stream.match(/\*\//)) {
state.cComment = false;
return "comment";
@wyozi
wyozi / deploy_functions.yml
Created March 21, 2023 08:49
Github action to deploy all serverless functions in a folder
name: Deploy serverless functions
on:
push:
paths:
- "functions/**"
branches:
- "main"
jobs:
list-functions:
runs-on: ubuntu-latest
@wyozi
wyozi / inngestEncrypted.ts
Created August 17, 2023 08:39
inngest encrypted step.run return value
import crypto from "crypto";
import { StepOpts } from "inngest/types";
const CRYPTO_KEY = process.env.BACKGROUND_VAR_CRYPTO_KEY;
export type Encrypted<T> = {
iv: string;
ciphertext: string;
};
@wyozi
wyozi / .eslintrc.js
Last active October 10, 2023 10:43
Next.js ESLint rule to enforce prefetch={false} for links
const rulesDirPlugin = require("eslint-plugin-rulesdir");
rulesDirPlugin.RULES_DIR = "eslint-rules";
module.exports = {
rules: {
"rulesdir/no-link-prefetch": "error",
}
}