Skip to content

Instantly share code, notes, and snippets.

Benjamin Fleischer bf4

Block or report user

Report or block bf4

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
@bf4
bf4 / find_relations_in_batches.rb
Created Mar 22, 2017
ActiveRecord Rails Find Relations in Batches
View find_relations_in_batches.rb
# Finds and yields relations in batches. Adapted from record.find_in_batches since that yields
# arrays and we want to operate on relationships.
# Adapted from:
# https://github.com/rails/rails/blob/4-2-stable/activerecord/lib/active_record/relation/batches.rb#L98-L115
def find_in_batches(target, batch_size: default_batch_size, start: nil)
relation = target
if logger && (target.arel.orders.present? || target.arel.taken.present?)
logger.warn("Scoped order and limit are ignored, it's forced to be batch order and batch size")
end
relation = relation.reorder(target.send(:batch_order)).limit(batch_size)
View learn_clojure_recipe.md
@bf4
bf4 / go_kinesis_with_structs.go
Created Mar 14, 2017 — forked from pricees/go_kinesis_with_structs.go
Go + AWS Kinesis + Encode/Decode Structs
View go_kinesis_with_structs.go
/**
NOTE:
Assumes env contains aws credentials:
AWS_ACCESS_KEY_ID or AWS_ACCESS_KEY
AWS_SECRET_KEY_ID or AWS_SECRET_KEY
and AWS_REGION_NAME (e.g. 'US-EAST-1')
see EnvAuth() below
*/
View 2014-09-30-sample.rb
message.to = 'Person Name <person@example.com>'
message.subject = 'Sample Subject'
# body is probably good enough, but you can set text_part/html_part below if you like
message.body = <<HERE.strip
Hey-
This is a sample
Thanks
HERE
@bf4
bf4 / dontforget.bash
Created Feb 20, 2017 — forked from ttscoff/dontforget.bash
Quick reminders from Terminal (bash)
View dontforget.bash
#!/bin/bash
# dontforget
#
# A stupid script for short term reminders in bash
#
# Arguments just need to contain a number and a bunch of words.
#
# The number can be anywhere in the arguments, but there shouldn't
# be any other numeric digits.
#
@bf4
bf4 / _dev_badge.html.slim
Created Feb 1, 2017 — forked from stevenharman/_dev_badge.html.slim
A simple badge that shows your Rails environment.
View _dev_badge.html.slim
/ In app/views/shared/
#dev-badge
span= Rails.env
span It ain't production!
View sidekiq_with_github.rb
require 'warden/github'
class SidekiqGithubChecker
def self.registered(app)
app.helpers do
def warden; env['warden'] end
def github_organization_authenticate!(name)
unless warden.user.organization_member?(name)
halt [401, {}, ["You don't have access to organization #{name}"]]
end
@bf4
bf4 / file.md
Created Jan 16, 2017 — forked from jjb/file.md
Trying to figure out performance impact of RUBY_GC_HEAP_GROWTH_FACTOR
View file.md
@bf4
bf4 / README.md
Created Jan 6, 2017 — forked from leonardofed/README.md
A curated list of AWS resources to prepare for the AWS Certifications
View README.md


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.


Index:

@bf4
bf4 / all_aws_lambda_modules.txt
Created Dec 15, 2016 — forked from gene1wood/all_aws_lambda_modules_python.md
AWS Lambda function to list all available Python modules and post the list to Pastebin
View all_aws_lambda_modules.txt
# module list (generated by listmodules.py)
#
# timestamp='20160226T200954Z'
# sys.version='2.7.10 (default, Dec 8 2015, 18:25:23) \n[GCC 4.8.3 20140911 (Red Hat 4.8.3-9)]'
# sys.platform='linux2'
# platform='Linux-4.1.13-19.31.amzn1.x86_64-x86_64-with-glibc2.2.5'
#
BaseHTTPServer
Bastion
CDROM
You can’t perform that action at this time.