Skip to content

Instantly share code, notes, and snippets.

Avatar

Tony Pujals subfuzion

View GitHub Profile
View dirname.sh
#!/bin/sh
strip_trailing_slashes() {
printf "$1" | sed 's/[/]*$//'
}
# If empty arg, return .
# If nothing but slashes, return /
# If no slashes after stripping all trailing slashes, return .
# Otherwise, return everything up until last path component
View unjar.sh
#!/bin/sh
# Dependencies: sed, grep
#
# Usage: unjar FILE [DEST]
#
# - DEST must not already exist (won't overwrite existing contents);
# path to DEST will be created.
# TODO: add overwrite option
#
# - If DEST is not provided, defaults to a subdirectory in the current
@subfuzion
subfuzion / README.md
Created Jun 25, 2021
Render UML diagram for your Dart package using dcdg and plantuml
View README.md
  1. Install plantuml

For example, on macOS you can use a Homebrew formula:

brew install plantuml

If plantuml fails to install, check the output for any missing formulae. For example, you may need to run the following before installing plantuml will succeed:

@subfuzion
subfuzion / download-dart.sh
Last active Sep 13, 2021
Install specific Dart releases
View download-dart.sh
#!/bin/bash
VERSION="$1"
CHANNEL="${CHANNEL:-dev}"
PLATFORM="${PLATFORM:-macos}"
ARCH="${ARCH:-x64}"
BASEURL="https://storage.googleapis.com/dart-archive/channels"
DARTSDK="dartsdk-$PLATFORM-$ARCH-release.zip"
DARTDOCS="dartdocs-gen-api.zip"
@subfuzion
subfuzion / Dockerfile
Last active Dec 2, 2020
Demonstrate using dart user instead of root. Not strictly a requirement for Dart, but it is for Flutter.
View Dockerfile
FROM google/dart
RUN \
groupadd --system dart && \
useradd --system --no-log-init --create-home --home /home/dart -g dart dart
WORKDIR /app
RUN chown dart:dart /app && chmod 775 /app
USER dart
@subfuzion
subfuzion / anthos-sample-deployment.env
Last active Apr 9, 2020
Anthos Sample Deployment shell scripts and specs
View anthos-sample-deployment.env
# This file is meant to be sourced into your shell for the Anthos Sample Deployment tutorial, ex:
# $ source init-anthos-tutorial.env
function info() {
printf "$1\n"
}
function warn() {
info $1
}
@subfuzion
subfuzion / getfilefuncname.go
Created Sep 27, 2019
[Example] Generate helpful test names
View getfilefuncname.go
package testhelper
import (
"path"
"reflect"
"runtime"
"strings"
)
// GetFileFunc takes a function and returns a string formatted as
// "basedir/filename/function" to make it easier to identify the
View specify-shared-credentials.js
const {defaultProvider} = require('@aws-sdk/credential-provider-node');
async function load() {
defaultProvider()
process.env.AWS_SDK_LOAD_CONFIG = true
let profile = process.env.AWS_DEFAULT_PROFILE || 'default'
try {
var provider = new aws.SharedIniFileCredentials({
@subfuzion
subfuzion / README.md
Last active Jan 5, 2019
Greeting Template
View README.md

Sample template (greeting.tpl) for testing with subfuzion/envtpl. Note that the template pipes to the title function, which will convert the value of $USER in your shell to initial uppercase (ex: tony => Tony).

Make sure you click the Raw button for greeting.tpl to get the correct link.

@subfuzion
subfuzion / README.md
Last active Aug 14, 2019
Test drive Istio
View README.md

Overview

The Istio docs provide comprehensive instructions for setting up Istio for a variety of environments. You will want to refer to them to understand the variety of configuration options and for more in depth explanations for the related topics. The following are concise notes based on my own experience running Istio using Docker for Mac with Kubernetes enabled, and basically meant to be a guide for demo purposes. Others may find this streamlined format useful as well.

Warning: the official docs for 0.8.0 are not entirely up-to-date. In particular, there are a number of errors in the Telemetry section. The steps in this guide have been verified to work.

To keep this concise, the setup is based on installing Istio

  • without using Helm
  • without mutual TLS between sidecars
  • with automatic sidecar injection