Skip to content

Instantly share code, notes, and snippets.

View cnunciato's full-sized avatar

Christian Nunciato cnunciato

View GitHub Profile
@cnunciato
cnunciato / main.js
Last active June 2, 2026 13:29
Rafflizer
[
"all",
"the",
"names"
].sort(() => Math.random() > .5 ? -1 : 1).slice(0, 3);
import pulumi
from pulumi_gcp import cloudrun
# Create a Cloud Run service.
service = cloudrun.Service("my-app",
location="us-central1",
template={
"spec": {
"containers": [{
"image": "us-docker.pkg.dev/cloudrun/container/hello",
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
import * as apigateway from "@pulumi/aws-apigateway";
import * as fs from "fs";
const fn = new aws.lambda.CallbackFunction("fn", {
callback: async (ev, ctx) => {
return {
statusCode: 200,
body: new Date().toISOString(),
@cnunciato
cnunciato / function.sh
Created June 15, 2024 15:21
Switch between Hugo versions
use_hugo() {
local VERSION="$1"
local TARFILE="hugo_${VERSION}_darwin-universal.tar.gz"
local TEMP_DIR="${HOME}/Downloads/hugo_temp"
local DESTFILE="${TEMP_DIR}/$TARFILE"
mkdir -p "$TEMP_DIR"
curl -L -o "$DESTFILE" "https://github.com/gohugoio/hugo/releases/download/v${VERSION}/${TARFILE}" && \
tar -xzvf "$DESTFILE" -C "$TEMP_DIR" && \
sudo mv "${TEMP_DIR}/hugo" "/usr/local/bin/" && \
@cnunciato
cnunciato / __main__.py
Last active June 4, 2024 15:49
Calling `pulumi.export` from within an `apply`
from some_module import make_bucket
# Call a function to make a bucket.
make_bucket()
#!/bin/bash
tokens=(
aws:lambda/function:Function
aws:s3/bucket:Bucket
aws:iam/role:Role
aws:ec2/instance:Instance
aws:rds/instance:Instance
aws:ec2/securityGroup:SecurityGroup
aws:ec2/vpc:Vpc
@cnunciato
cnunciato / helper.sh
Created January 4, 2024 23:08
pulumi new helper
pnew() {
local project_template="$1"
local project_home="${HOME}/Projects/dev/pulumi"
local project_name="${1}-$(head -n 4096 /dev/urandom | openssl sha1 | awk "{print \$2}" | cut -c1-7)"
local project_dir="${project_home}/${project_name}"
mkdir -p "$project_dir" && cd "$project_dir"
pulumi new "$project_template"
}
@cnunciato
cnunciato / Pulumi.yaml
Created October 28, 2023 15:32
A Pulumi program as a Gist
name: ${PROJECT}
description: ${DESCRIPTION}
runtime:
name: nodejs
options:
typescript: false
template:
description: A minimal AWS JavaScript Pulumi program
important: true
config:
@cnunciato
cnunciato / main.go
Last active January 12, 2023 19:59
Converting a pulumi.IDOutput to a string and using it in a lookup function
package main
import (
"fmt"
"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/ec2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
➜ depth .
.
├ fmt
├ github.com/pulumi/pulumi-azure-native-sdk/resources
├ context
├ fmt
├ os
├ reflect
├ regexp
├ strconv