Skip to content

Instantly share code, notes, and snippets.

View timburks's full-sized avatar
🌞
summer

Tim Burks timburks

🌞
summer
View GitHub Profile
@timburks
timburks / main.go
Created July 6, 2023 17:35
Generate mock API descriptions
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
#!/bin/sh
# If PROJECT_ID is set, use it. If not, default to the value after the dash.
PROJECT_ID=${PROJECT_ID:-registry-eval}
TOKEN=`gcloud auth print-access-token`
# Delete the API and its child resources if it already exists.
curl https://apigeeregistry.googleapis.com/v1/projects/${PROJECT_ID}/locations/global/apis/sample?force=true \
-X DELETE \
@timburks
timburks / download.sh
Last active February 24, 2023 19:50
Download the latest release of the Registry Tool
#!/bin/bash
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
#!/bin/bash
# Usage: sh provision_apihub.sh -p GCP-PROJECT-ID -l us-central1 -u GCP-USER-EMAIL -r KEY-RING-NAME -k KEY-NAME
unset project_id
unset location
unset user
unset key_ring_name
unset key_name
while getopts p:l:u:r:k: opt; do
@timburks
timburks / static-wordle.go
Last active January 10, 2022 05:13
"serai blunt moped" are the three best words to start a Wordle game according to this greedy algorithm that seeks to minimize the largest set of possible solutions after each successive guess.
package main
import (
"fmt"
"io/ioutil"
"sort"
"strings"
)
// This computes a list of static guesses to prune the Wordle solution space.
@timburks
timburks / openapi-v3.go
Created November 27, 2021 23:41
A (messy) version of the protoc-gen-openapi code generator that generates hierarchical names for hierarchically-defined messages.
// Copyright 2020 Google LLC. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@timburks
timburks / RUNME.sh
Created October 8, 2021 03:24
protoc compilation challenge
#!/bin/sh
# clone envoy and dependencies
if [ ! -d "envoy" ]
then
git clone git@github.com:envoyproxy/envoy
fi
if [ ! -d "protoc-gen-validate" ]
then
@timburks
timburks / DEMO.sh
Created September 22, 2021 00:47
HTTP samples
#!/bin/sh
#
# Copyright 2021 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@timburks
timburks / main.dart
Created December 2, 2020 05:31
Comparing Dart instance methods
class Foo {
void f() {
print("f");
}
}
void main() {
Foo a = Foo();
Foo b = Foo();
print("${a.f == b.f}");
@timburks
timburks / beat-machine.dart
Last active May 10, 2020 04:43
100-line web-based drum machine in flutter
import 'package:flutter/material.dart';
import 'package:universal_html/html.dart' as web;
import 'dart:async';
const instruments = ["hat", "stick", "cymbal", "snare", "bass"];
List<_ButtonRowState> states = [];
main() {
const delta = const Duration(milliseconds: 160);