Skip to content

Instantly share code, notes, and snippets.

View thundergolfer's full-sized avatar
👟
Loading...

Jonathon Belotti thundergolfer

👟
Loading...
View GitHub Profile
import modal
def download_model():
from transformers import pipeline
pipeline("fill-mask", model="bert-base-uncased")
CACHE_PATH = "/root/model_cache"
ENV = modal.Secret({"TRANSFORMERS_CACHE": CACHE_PATH})
image = (
@thundergolfer
thundergolfer / bazel_install.sh
Last active January 15, 2023 23:58
Install Bazel (with Bazelisk) on Codespaces
#!/usr/bin/env bash
main() {
local version
local dest
local op_sys
local architecture
version="v1.7.4"
dest="/usr/local/bin/bazel"
# Run with `ruby coin_change.rb`
# Use to optimally make some number N from a set of candidate integer 'parts'
class ChangeMaker
def initialize(choices)
@choices = choices.sort_by { |n| -n }
end
def change(amount)
@thundergolfer
thundergolfer / bazel_lang_support_tracking.md
Last active January 9, 2021 05:16
Bazel language support

Description

Below is a compatibility table. It includes the top 25 TIOBE languages and relevant languages from 25-50 (eg. Scala). For these languages, the table shows Bazel Support which is whether there are Bazel rules for the language.


Language Tiobe Index Rank (2019) Bazel Support
Java 1
C 2
@thundergolfer
thundergolfer / crash.log
Created October 18, 2019 10:01
Terraform bug 2019-10-19
2019/10/18 20:51:47 [INFO] Terraform version: 0.12.9
2019/10/18 20:51:47 [INFO] Go runtime version: go1.13
2019/10/18 20:51:47 [INFO] CLI args: []string{"/usr/local/bin/terraform", "apply", "-state=dev.tfstate", "-var-file=/Users/jonathonbelotti/Code/thundergolfer/the-one-true-bazel-monorepo/infrastructure/gcloud/gcloud.tfvars", "-var-file=/Users/jonathonbelotti/Code/thundergolfer/the-one-true-bazel-monorepo/infrastructure/gcloud/gke/dev.tfvars"}
2019/10/18 20:51:47 [DEBUG] Attempting to open CLI config file: /Users/jonathonbelotti/.terraformrc
2019/10/18 20:51:47 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2019/10/18 20:51:47 [INFO] CLI command args: []string{"apply", "-state=dev.tfstate", "-var-file=/Users/jonathonbelotti/Code/thundergolfer/the-one-true-bazel-monorepo/infrastructure/gcloud/gcloud.tfvars", "-var-file=/Users/jonathonbelotti/Code/thundergolfer/the-one-true-bazel-monorepo/infrastructure/gcloud/gke/dev.tfvars"}
2019/10/18 20:51:47 [TRACE] Meta.Backend: no config given or present
@thundergolfer
thundergolfer / move-repo-between-github-orgs.sh
Last active April 7, 2019 06:09
Move a Github repository from your account to an organisation. Credit to: https://www.codesections.com/blog/cleaning-github-with-a-simple-bash-script/
# Inspired by https://www.codesections.com/blog/cleaning-github-with-a-simple-bash-script/ I decided to
# take multi-organisation approach to organise my Github repositories.
#
# This script allows for quickly transferring a repository in your account to a Github
# organisation you control.
#
# Note: Private repositories must be made public before they can be moved to a 'free-tier' Organisation.
#
# Usage: ./move-repos.sh <REPO NAME> <NEW ORG>

Keybase proof

I hereby claim:

  • I am thundergolfer on github.
  • I am thundergolfer (https://keybase.io/thundergolfer) on keybase.
  • I have a public key whose fingerprint is 522A EB82 C191 04D8 5B13 4F59 7181 3C5F F380 8DFC

To claim this, I am signing this object:

## USAGE
##
## Step 1: Clone aimacode python repo from Github
## Step 2: Place this script in the root directory of that repo
## Step 3: Run `python tute_8_value_iteration.py`
import types
def value_iteration_stepper(mdp, epsilon=0.001):
"""Solving an MDP by value iteration. [Figure 17.4]"""

Browserify: Running Node JS in the browser

Prerequisites

  1. Install Node JS
  2. Check installation of NodeJS and NPM (installed with NodeJS): npm -v and node -v

The Problem

If you want to develop some Javascript the needs to run in a browser and want to make use of the NodeJS development and package ecosystem, much of which involves code that is incompatible with a browser, then you'll need a way to transform browser-incompatible code into compatible code.

#
# Solves the 'Jug Problem' from RMIT AI Sem 1 2018 Tutorial 1
#
# The state space graph for this problem contains multiple cycles, so we
# can't rely on a naive search fully exploring the graph without getting stuck in a cycle
#
# In order to combat the cycles, I introduce some randomness into operation choices and
# set a maximum search depth that well exceeds the known depth of the most efficient solution
# NOTE: This is rough code. It's hashed out and it's ugly.