Skip to content

Instantly share code, notes, and snippets.

Brennan Holzer bholzer

Block or report user

Report or block bholzer

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View spider.js
$( function() {
var width, height, canvas, ctx, points, target, animateHeader = true;
// Main
initHeader();
initAnimation();
addListeners();
function initHeader() {
@bholzer
bholzer / animation_config.py
Last active Jun 14, 2018
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
@bholzer
bholzer / bucket_encrypter.rb
Last active May 2, 2018
Encrypt existing objects in S3 bucket.
View bucket_encrypter.rb
#!/usr/bin/env ruby
#
# Script to encrypt the contents of an entire S3 bucket
#
# This works by copying each object in the bucket onto
# itself while modifying its server_side_encryption attribute
#
#
##############################################################
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);
}
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);
}
View engchi.scala
def englishChi2(bytes: Array[Byte]): Double = {
val englishLetterFrequency = Map(
'A' -> 0.08167, 'B' -> 0.01492, 'C' -> 0.02782, 'D' -> 0.04253,
'E' -> 0.12702, 'F' -> 0.02228, 'G' -> 0.02015, 'H' -> 0.06094,
'I' -> 0.06966, 'J' -> 0.00153, 'K' -> 0.00772, 'L' -> 0.04025,
'M' -> 0.02406, 'N' -> 0.06749, 'O' -> 0.07507, 'P' -> 0.01929,
'Q' -> 0.00095, 'R' -> 0.05987, 'S' -> 0.06327, 'T' -> 0.09056,
'U' -> 0.02758, 'V' -> 0.00978, 'W' -> 0.02360, 'X' -> 0.00150,
'Y' -> 0.01974, 'Z' -> 0.00074, ' ' -> 0.19181
)
You can’t perform that action at this time.