Skip to content

Instantly share code, notes, and snippets.

Joe Feeney iamatypeofwalrus

Block or report user

Report or block iamatypeofwalrus

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 vs-code-key-bindings.json
[
// Git
{
"key": "ctrl+b",
"command": "gitlens.toggleFileBlame",
"when": "editorTextFocus && gitlens:activeIsBlameable"
}
{
"key": "alt+cmd+s",
"command": "git.stageSelectedRanges"
View vscode-settings.json
// Place your settings in this file to overwrite the default settings
{
"editor.fontSize": 14,
"editor.tabSize": 2,
"editor.insertSpaces": true,
"editor.detectIndentation": true,
"editor.rulers": [
80,
100
],
View dynamodb-backup-common.cf.yaml
---
AWSTemplateFormatVersion: '2010-09-09'
Description: 'Common resources for DynamoDB backups'
Resources:
DynamoDBBackupsBucket:
Type: "AWS::S3::Bucket"
Properties:
BucketName:
Fn::Join:
- "-"
@iamatypeofwalrus
iamatypeofwalrus / data-pipelines.cf.yaml
Created Nov 10, 2017
Data Pipelines in Cloudformation
View data-pipelines.cf.yaml
---
AWSTemplateFormatVersion: '2010-09-09'
Description: 'Backup DynamoDB table to S3, convert export to Parquet, and add table to Athena'
Parameters:
TableName:
Description: DynamoDB table name
Type: String
BackupMaximumConsumedReadThroughput:
Description: Percentage of table read throughput a backup can use. Expressed between 0.01 and 1.0. Defaults to 20% of available read throughput
Type: Number
@iamatypeofwalrus
iamatypeofwalrus / connection_pool_issue.rb
Created Mar 1, 2017
Ruby Aws SDK V2 ConnectionPool forking issue
View connection_pool_issue.rb
# Run and fail
# AWS_ACCESS_KEY_ID=*** ruby connection_pool_issue.rb
#
# Does not crash
# empty_connection_pools_after_fork=true ruby connection_pool_issue.rb
#
# Hypothesis:
#
# the Aws SDK maintains a ConnectionPool in Seahorse. After fork
# file descriptors are shared between the parent process and any child processes.
@iamatypeofwalrus
iamatypeofwalrus / method_trace.rb
Created Feb 18, 2017
Smoke test for using the Kernel#set_trace_func in Ruby 2.x
View method_trace.rb
# Official docs are a _bit_ light on specifcs
# http://ruby-doc.org/core-2.0.0/Kernel.html#method-i-set_trace_func
#
# There are other options if you are interested in a general trace:
# * ruby -r tracer your_script.rb
# * https://ruby-doc.org/core-2.3.0/TracePoint.html
#
# What I'd like to be able to do is create a helper module / class that can be added to any class like so:
#
@iamatypeofwalrus
iamatypeofwalrus / localdocker.md
Last active Aug 29, 2015
localdocker: It's like localhost for your boot2docker ip address
View localdocker.md

Why?

Having to remeber what the boot2docker ip address sucks, wouldn't it be better to access it like localhost?

You can!

First you need to get the boot2docker ip address. You can get that in terminal:

$ boot2docker ip

On my computer I get:

@iamatypeofwalrus
iamatypeofwalrus / generate_ctags.md
Last active Feb 11, 2019
Generate ctags for Atom (or for any other reason) on Mac os X
View generate_ctags.md

Why?

Atom can automagically picks up any tags file in your current directory which enables you to:

  • shift+cmd+r search for any function in your project
  • alt+cmd+down GoTo a function declaration

How

Get brew if you don't already have it. Then:

brew install ctags

@iamatypeofwalrus
iamatypeofwalrus / channel_check.go
Created Dec 11, 2014
Check if a Go Channel is open or closed
View channel_check.go
// An intersting pattern for testing, but you can use the check anywhere
import "testing"
func TestCheckingChannel(t *testing.T) {
stop := make(chan bool)
// Testing some fucntion that SHOULD close the channel
func (stop chan bool) {
close(chan)
}(stop)
@iamatypeofwalrus
iamatypeofwalrus / README.md
Last active Jun 12, 2019
A Rails 4 pluck in batches implementation
View README.md

pluck_in_batches

Sometimes you need to iterate over a ton of items and you don't want the overhead of creating AR objects out of all of them. Hell, you only need a few things! Well, #pluck has your back.

But what if you want to iterate over many tonnes of items?

Pluck in batches to the rescue!

This isn't the exact code that I use in my code base, but it is damn close.

You can’t perform that action at this time.