Skip to content

Instantly share code, notes, and snippets.

View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Object iteration</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@bholzer
bholzer / set_params.sh
Created Mar 15, 2020
Fetch and set environment variables from AWS systems manager param store.
View set_params.sh
#!/bin/bash
params=$(aws ssm get-parameters-by-path --region $REGION --with-decryption --path "/path/to/variable" --recursive)
for param in $(echo $params | jq -r ".Parameters[] | @base64"); do
ORIG_IFS=$IFS
IFS="/"
full_name=$(echo $param | base64 --decode | jq -r ".Name")
read -ra name_components <<< "$full_name"
IFS=$ORIG_IFS
var_name=${name_components[-1]}
@bholzer
bholzer / out.rb
Created Feb 8, 2020
BulqScriptOutput
View out.rb
{:title=>"General Merchandise - General Merchandise, Bojeux - Orig. Retail $139", :price=>"$62", :manifest_link=>"https://www.bulq.com/pallet_manifests/csaa086314/general-merchandise-general-merchandise-bojeux.xlsx"}
{:title=>"General Merchandise - General Merchandise, As Seen On TV, Up & Up - Orig. Retail $291", :price=>"$91", :manifest_link=>"https://www.bulq.com/pallet_manifests/csaa086362/general-merchandise-general-merchandise-as-seen-on-tv-up-up.xlsx"}
{:title=>"General Merchandise - General Merchandise, Magnolia Home by Joanna Gaines, The Manhattan Toy Company - Orig. Retail $262", :price=>"$75", :manifest_link=>"https://www.bulq.com/pallet_manifests/csaa086353/general-merchandise-general-merchandise-magnolia-home-by-joanna-gaines-the-manhattan-toy-company.xlsx"}
{:title=>"General Merchandise - General Merchandise, Heyday, Kanex - Orig. Retail $504", :price=>"$128", :manifest_link=>"https://www.bulq.com/pallet_manifests/csaa086797/general-merchandise-general-merchandise-heyday-kanex.xlsx"}
{:title=>"Ge
View gist:5c8c18752503afecfc40ad320961acec
module.worker_node.aws_autoscaling_policy.worker_node_scale_in: Modifying... [id=worker_node_scale_in]
2019/10/03 16:16:21 [TRACE] GetResourceInstance: aws_autoscaling_group.worker_nodes is a single instance
2019/10/03 16:16:21 [DEBUG] module.worker_node.aws_autoscaling_policy.worker_node_scale_in: applying the planned Update change
2019/10/03 16:16:21 [TRACE] GRPCProvider: ApplyResourceChange
2019-10-03T16:16:21.559-0500 [DEBUG] plugin.terraform-provider-aws_v2.31.0_x4: 2019/10/03 16:16:21 [DEBUG] AutoScaling PutScalingPolicy on Update: {
2019-10-03T16:16:21.560-0500 [DEBUG] plugin.terraform-provider-aws_v2.31.0_x4: AdjustmentType: "PercentChangeInCapacity",
2019-10-03T16:16:21.560-0500 [DEBUG] plugin.terraform-provider-aws_v2.31.0_x4: AutoScalingGroupName: "render_workers",
2019-10-03T16:16:21.560-0500 [DEBUG] plugin.terraform-provider-aws_v2.31.0_x4: Cooldown: 0,
2019-10-03T16:16:21.560-0500 [DEBUG] plugin.terraform-provider-aws_v2.31.0_x4: EstimatedInstanceWarmup: 0,
2019-10-03T16:16:21.560-0500 [
@bholzer
bholzer / animation_config.py
Last active Feb 19, 2022
Blender rendering from the command line.
View animation_config.py
import sys
import bpy
import addon_utils
argv = sys.argv
argv = argv[argv.index("--") + 1:] # get all args after "--"
C = bpy.context
bpy.context.scene.cycles.device = 'GPU'
cycles_prefs = C.user_preferences.addons['cycles'].preferences
View verbose.rb
def response_for_auth_fail(auth_error: :invalid)
messages = {
invalid: "Some error",
inactive: "Some error"
locked: "Some error"
}
{ auth_error: auth_error, message: messages[:auth_error] }
end
@bholzer
bholzer / cloudbuild.yml
Last active Jan 2, 2018
Cloudbuild config for automating deployments to Kubernetes using Helm.
View cloudbuild.yml
steps:
- name: 'gcr.io/cloud-builders/git'
# Determine if the commit that triggered this build includes a directive to destroy a previously created environment
# If so, write a file as a flag for conditional future steps, always return true to allow build to continue
entrypoint: '/bin/bash'
args:
- '-c'
- 'git log -n 1 --pretty=format:%s $COMMIT_SHA | grep -q "\[helm\-delete\]" && touch /workspace/helm_delete || true'
- name: 'gcr.io/cloud-builders/docker'
View thing.rb
templates = Templates.all
mapped_things = pairs.map do |pair|
object = templates.find{|t| t.id == pair.second }
object = object.dup
object.thing_id = pair.first
object
end.compact
View infinite.jsx
class DateVerifier extends React.Component {
constructor(props) {
super(props)
this.state = {
dob: null
}
}
render() {
return (
View ColorListSorter.java
import java.awt.Color;
import java.util.*;
public class ColorListSorter {
public static void quickSort(List<Color> list, int pivot, int end) {
if (pivot < end) {
int q = partition(list, pivot, end);
quickSort(list, pivot, q);
quickSort(list, q+1, end);
}