Skip to content

Instantly share code, notes, and snippets.

View subfuzion's full-sized avatar

Tony Pujals subfuzion

View GitHub Profile
@subfuzion
subfuzion / README.md
Last active February 5, 2023 03:32
How to use Docker bind mount instead of copying files for a local dev container.

Example of a Docker bind mount.

Create an example directory and copy the following script to it. Make it executable and then run it.

$ chmod +x demo.sh
$ ./demo.sh
.
.
.
@subfuzion
subfuzion / README.md
Created January 16, 2022 02:16
Install Python 3.9 on Ubuntu
sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.9
@subfuzion
subfuzion / .bash_profile
Last active August 6, 2022 22:25
macpro-files
if [ -f ~/.bashrc ]; then . ~/.bashrc; fi
#!/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
#!/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 June 25, 2021 06:38
Render UML diagram for your Dart package using dcdg and plantuml
  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 September 13, 2021 15:36
Install specific Dart releases
#!/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 December 2, 2020 02:54
Demonstrate using dart user instead of root. Not strictly a requirement for Dart, but it is for Flutter.
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 April 9, 2020 17:29
Anthos Sample Deployment shell scripts and specs
# 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 September 27, 2019 01:11
[Example] Generate helpful test names
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