Skip to content

Instantly share code, notes, and snippets.

View FreedomBen's full-sized avatar
💭
Currently setting my status

Ben Porter FreedomBen

💭
Currently setting my status
View GitHub Profile
@FreedomBen
FreedomBen / add-ruby-debug.py
Created September 22, 2014 20:21
Add Debug printout for ruby programs
#!/usr/bin/python
import sys
import os
REMOVE_FLAG = '<remove>'
COMMENT_STRING = '# Added by debug script. To remove, rerun script with -c|--cleanup flag'
DEBUG_STATEMENT = """
Rails.logger.debug("In method:".blue + " - " +
"#{self.nil? ? String.new : self.class.to_s}".green +

Keybase proof

I hereby claim:

  • I am freedomben on github.
  • I am freedomben (https://keybase.io/freedomben) on keybase.
  • I have a public key whose fingerprint is CD29 50AF BCC3 673B 4EA0 15A9 1559 13A0 D679 AF92

To claim this, I am signing this object:

@FreedomBen
FreedomBen / README.md
Created October 15, 2016 01:43 — forked from nickpiesco/README.md
DRY out Media Queries with React and Radium

Here at Bloomfire, we’re loving building new components with React. We’re even going all in with using ES6 modules and inline styles. (‘Inline styles?!’ I hear you say? Don’t knock it ’til you’ve tried it.)

There’s a lot of cool stuff we can do with CSS that we can’t do with inline styles, though; and that’s where Radium comes in. Radium not only provides a handy way to style :hover, :focus, and :active states, but it also deftly handles media queries. If you’re using inline styles in React and not using Radium, you should. I’ll give you a minute to go look it over – here’s the link again.

Back? Okay.

We create a style object in each of our React components, which we then reference in the JSX below. Here’s a super-stripped-down example:

// [myAwesomeButton.js]
@FreedomBen
FreedomBen / actionlist.vim
Created October 16, 2017 22:11 — forked from zchee/actionlist.vim
IdeaVim actionlist
--- Actions ---
$Copy <M-C>
$Cut <M-X> <S-Del>
$Delete <Del> <BS> <M-BS>
$LRU
$Paste <M-V>
$Redo <M-S-Z> <A-S-BS>
$SearchWeb <A-S-G>
$SelectAll <M-A>
$Undo <M-Z>
@FreedomBen
FreedomBen / pre-commit
Created May 1, 2018 18:13 — forked from hraban/pre-commit.md
Git pre-commit hook (.git/hooks/pre-commit) to prevent accidentally committing debug code (add NOCOMMIT in source comment)
#!/bin/sh
# This pre-commit hook will prevent you from committing any line (or filename) containing
# the string NOCOMMIT. Use that tag in comments around source code you want to avoid
# accidentally committing, like temporary IP addresses or debug printfs.
#
# To add it to an existing repository, save it to .git/hooks/pre-commit (or append, if
# that file already exists). Remember to make executable (chmod +x ...)
#
# To automatically add this pre-commit hook to every repository you create or clone:
@FreedomBen
FreedomBen / k8s-svc-annotations.md
Created February 26, 2019 00:02 — forked from mgoodness/k8s-svc-annotations.md
AWS ELB-related annotations for Kubernetes Services (as of v1.12.0)
  • service.beta.kubernetes.io/aws-load-balancer-access-log-emit-interval (in minutes)
  • service.beta.kubernetes.io/aws-load-balancer-access-log-enabled (true|false)
  • service.beta.kubernetes.io/aws-load-balancer-access-log-s3-bucket-name
  • service.beta.kubernetes.io/aws-load-balancer-access-log-s3-bucket-prefix
  • service.beta.kubernetes.io/aws-load-balancer-additional-resource-tags (comma-separated list of key=value)
  • service.beta.kubernetes.io/aws-load-balancer-backend-protocol (http|https|ssl|tcp)
  • service.beta.kubernetes.io/aws-load-balancer-connection-draining-enabled (true|false)
@FreedomBen
FreedomBen / clone.rb
Last active June 5, 2020 18:35
Clone an OpenShift app (rough script that will need tweaking)
#!/usr/bin/env ruby
require 'json'
require 'yaml'
APP_LABEL = "mtls-nginx-example"
OUTPUT_FILENAME = "clone-output.yaml"
#OC_CONFIG = ""
OC_CONFIG = "--config ~/.kube/devcluster.conf"
@FreedomBen
FreedomBen / default-project-template.yaml
Created November 10, 2020 20:36
Default OpenShift Project Template
apiVersion: template.openshift.io/v1
kind: Template
metadata:
creationTimestamp: null
name: project-request
objects:
- apiVersion: project.openshift.io/v1
kind: Project
metadata:
annotations:
- apiVersion: v1
kind: LimitRange
metadata:
creationTimestamp: null
name: ${PROJECT_NAME}-limits
spec:
limits:
- type: Container
default:
cpu: 1000m
@FreedomBen
FreedomBen / default-project-template-with-limit-range.yaml
Created November 10, 2020 20:46
A LimitRange added to the default Project template
apiVersion: template.openshift.io/v1
kind: Template
metadata:
creationTimestamp: null
name: project-request
namespace: openshift-config
objects:
- apiVersion: project.openshift.io/v1
kind: Project
metadata: