- ⌘-t --> Go to Today
- ctrl-a --> go to beginning of terminal line
- ctrl-e --> go to end of terminal line
- alt-click --> go to character
| // 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 | |
| } |
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.
| // 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) |
| # 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: | |
| # |
| # 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. |
| --- | |
| 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 |
| --- | |
| AWSTemplateFormatVersion: '2010-09-09' | |
| Description: 'Common resources for DynamoDB backups' | |
| Resources: | |
| DynamoDBBackupsBucket: | |
| Type: "AWS::S3::Bucket" | |
| Properties: | |
| BucketName: | |
| Fn::Join: | |
| - "-" |