Skip to content

Instantly share code, notes, and snippets.

View timmyers's full-sized avatar

Tim Myers timmyers

View GitHub Profile
@timmyers
timmyers / main.py
Created May 10, 2023 20:15
Stable Diffusion 2.1 Example
from diffusers import StableDiffusionPipeline, EulerDiscreteScheduler
import torch
model_id = "stabilityai/stable-diffusion-2-1-base"
scheduler = EulerDiscreteScheduler.from_pretrained(model_id, subfolder="scheduler")
pipe = StableDiffusionPipeline.from_pretrained(model_id, scheduler=scheduler, torch_dtype=torch.float16)
pipe = pipe.to("cuda")
prompt = "a photo of an astronaut riding a horse on mars"
@timmyers
timmyers / route53.ts
Created January 26, 2023 22:41
Fearless tools DNS
import * as aws from '@pulumi/aws';
const defaultTags = { Creator: 'pulumi' };
const fearlessTools = new aws.route53.Zone('fearless.tools', {
name: 'fearless.tools',
tags: { Name: 'fearless.tools', ...defaultTags },
});
new aws.route53.Record('fearless.tools', {
@timmyers
timmyers / index.ts
Created January 26, 2023 22:21
fearless.tools homepage
import Head from 'next/head'
export default function Home() {
return (
<>
<Head>
<title>Fearless Tools</title>
<meta name="description" content="Infrastructure without fear" />
<link rel="icon" href="/favicon.ico" />
</Head>
@timmyers
timmyers / index.ts
Created November 14, 2022 04:03
Initial CrossGuard Policy
import * as aws from '@pulumi/aws';
import { PolicyPack, ReportViolation, validateResourceOfType } from '@pulumi/policy';
new PolicyPack('aws', {
policies: [
{
name: 'required-tags',
description: 'Certain tags are required.',
enforcementLevel: 'mandatory',
@timmyers
timmyers / index.ts
Created November 14, 2022 03:54
Resource with different tags
const bobUser = new aws.iam.User('bob.bobby', {
name: 'bob.bobby',
tags: { Name: 'bob.bobby },
})
@timmyers
timmyers / index.ts
Created November 14, 2022 03:50
Resource with tags
import * as aws from '@pulumi/aws';
const defaultTags = { Creator: 'pulumi' };
const timUser = new aws.iam.User('tim.myers', {
name: 'tim.myers',
tags: defaultTags,
});
@timmyers
timmyers / index.ts
Created October 9, 2022 19:52
Pulumi AWS Budget
import * as aws from '@pulumi/aws';
new aws.budgets.Budget('total-monthly-cost', {
name: 'total-monthly-cost',
budgetType: 'COST',
limitAmount: '10',
limitUnit: 'USD',
timeUnit: 'MONTHLY',
notifications: [{
comparisonOperator: 'GREATER_THAN',
@timmyers
timmyers / pulumi.yml
Created October 4, 2022 01:17
Pulumi IaC Github Workflow
name: pulumi
'on':
push:
branches:
- main
pull_request:
types:
- opened
- synchronize
@timmyers
timmyers / index.ts
Created October 4, 2022 01:04
Pulumi IaC Github IAM Role
import * as aws from '@pulumi/aws';
const defaultTags = { Creator: 'pulumi' };
const githubOIDC = new aws.iam.OpenIdConnectProvider('github', {
url: 'https://token.actions.githubusercontent.com',
thumbprintLists: ['15e29108718111e59b3dad31954647e3c344a231'],
clientIdLists: ['sts.amazonaws.com'],
tags: defaultTags,
});
@timmyers
timmyers / Pulumi.main.yaml
Created October 4, 2022 00:55
Pulumi IAM role config
config:
aws:region: us-west-2
aws:assumeRole:
roleArn: arn:aws:iam::<AWS Account ID>:role/infrastructure