Skip to content

Instantly share code, notes, and snippets.

@iamatypeofwalrus
iamatypeofwalrus / vs-code-key-bindings.json
Created January 19, 2018 17:19
VS Code Key Bindings
[
// Git
{
"key": "ctrl+b",
"command": "gitlens.toggleFileBlame",
"when": "editorTextFocus && gitlens:activeIsBlameable"
}
{
"key": "alt+cmd+s",
"command": "git.stageSelectedRanges"
@iamatypeofwalrus
iamatypeofwalrus / vscode-settings.json
Created January 19, 2018 17:18
My VS Code Settings
// 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
],
@iamatypeofwalrus
iamatypeofwalrus / dynamodb-backup-common.cf.yaml
Created November 10, 2017 04:03
DynamoDB backup Common
---
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 November 10, 2017 04:02
Data Pipelines in Cloudformation
---
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 March 1, 2017 21:56
Ruby Aws SDK V2 ConnectionPool forking issue
# 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 February 18, 2017 04:51
Smoke test for using the Kernel#set_trace_func in Ruby 2.x
# 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 / ssh_give_terminal_tabs_useful_names.md
Last active May 6, 2016 15:22
Customize SSH tab name in Mac OS X terminal auto-magically.

What

Automtically configure tab name in Terminal.app when ssh-ing to a server. You can use any shell commands you want to get the desired output.

Why

I work on external servers 8 hours a day M-F and more likely than not I have multiple ssh sessions at the same time to the same sever under different users. It became a bit of a pain to have to rename the tabs everytime I logged on to a server. I just wanted that to happen auto-magically.

I searched the interwebs and came across this CNet article which had about 99% of what I was looking for. However, it never really mentioned how to modify the script to insert your own formatting. It didn't even mention adding it to your $PATH! So after a few minutes of messing with it I got something quite reasonable. I thought I'd share the results.

How

@iamatypeofwalrus
iamatypeofwalrus / commands.md
Created September 3, 2014 18:17
Mac OS X -> Productivity Commands

Calendar

  • ⌘-t --> Go to Today

Terminal

  • ctrl-a --> go to beginning of terminal line
  • ctrl-e --> go to end of terminal line
  • alt-click --> go to character
@iamatypeofwalrus
iamatypeofwalrus / localdocker.md
Last active August 29, 2015 14:15
localdocker: It's like localhost for your boot2docker ip address

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 / add_int_to_character.swift
Created July 21, 2014 18:16
A convoluted way to add an Integer to a Character and get another Character in Swift
// Per the BNR iOS programming guide's chapter on creating BNRItem
import Cocoa
import Foundation
extension Character {
func unicodeIntValue() -> UInt32
{
let str = String(self)
return str.unicodeScalars[str.unicodeScalars.startIndex].value
}