View promise.js
// Sometimes I have a promise chain that returns out of a promise before
// the the execution is actually completed. Maybe i'm not returning correctly?
// Anyway, might a common problem for a newb like me.
// here is a way to add a delay in the promise chain to wait for the previous
// promise to complete. This is NOT best practice, but maybe it can be used as
// a troubleshooting tool.
//
...
.then(() => {...})
.then(() => {
View cannot-read-property-getTableName.md

TypeError: Cannot read property 'getTableName' of undefined

I've had this error on numerous occasions. Here are a few things to look for:

  • Check that the table name that is included in the query is spelled correctly, check that is it defined correctly.
  • If you are running tests and using Mockery, check that Mockery is setup correctly. Try removing Mockery and running the test.
View BBC-Radio.m3u
#EXTM3U
#EXTINF:-1,BBC - Radio 1
http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio1_mf_p
#EXTINF:-1,BBC - Radio 2
http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio2_mf_p
#EXTINF:-1,BBC - Radio 3
http://open.live.bbc.co.uk/mediaselector/5/select/version/2.0/mediaset/http-icy-aac-lc-a/format/pls/vpid/bbc_radio_three.pls
#EXTINF:-1,BBC - Radio 4
http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio4fm_mf_p
#EXTINF:-1,BBC - Radio 5 live
View knit.rb
#!/usr/bin/env ruby
# recursively `yarn link` together all `file:<path>` deps in package.json
# manifests.
#
# USAGE
#
# knit.rb PACKAGE_DIRECTORY
#
# AUTHOR nrser
View 1nf.md

First Normal Form or 1NF

  • Database table values must be atomic. That is, the value represented can not be decomposed any further. eg two diferent phone numbers is the telephone field.
  • Database table must be isomorphic. A table is isomorphic to some relation if the following are met:
  1. order of rows has no meaning
  2. column order has no meaning
  3. there are no duplicate rows
  4. Every row and column intersection has a value (null is considered a value)
  5. All columns are regular (no hidden components)
View serverless-code-dependency.md

How to get Serverless project file dependencies to work with Lambda

In AWS Lambdas, if you require a file like ../../../../lib you're out of luck. Serverless will not resolve that file correctly when creating the zip. This happens when the serverless.yml files are buried deep in your project directories. Node modules dependencies are handled correctly. (thats good).

To add lib, models, etc. correctly, I'm trying an approach using environment variables.

Here's our API directory structure. All of our shared files, like lib and models are at the root level. Many lambdas may need access to the same mode or library.

We have hundreds of lambdas and have run into issues when having so many in one serverless.yml file. This approach allows to have one project, The API, with many serverless.yml dividing it all up into manageable services that can share code.

View gist:e5d3767eb4b08b2d7dfa17a9f0ca0e49

Anchors in Markdown

To create an anchor to a heading in github flavored markdown. Add - characters between each word in the heading and wrap the value in parens (#some-markdown-heading) so your link should look like so:

[create an anchor](#anchors-in-markdown)

View 201702-s3-outage.md

Summary of the Amazon S3 Service Disruption in the Northern Virginia (US-EAST-1) Region We’d like to give you some additional information about the service disruption that occurred in the Northern Virginia (US-EAST-1) Region on the morning of February 28th. The Amazon Simple Storage Service (S3) team was debugging an issue causing the S3 billing system to progress more slowly than expected. At 9:37AM PST, an authorized S3 team member using an established playbook executed a command which was intended to remove a small number of servers for one of the S3 subsystems that is used by the S3 billing process. Unfortunately, one of the inputs to the command was entered incorrectly and a larger set of servers was removed than intended. The servers that were inadvertently removed supported two other S3 subsystems. One of these subsystems, the index subsystem, manages the metadata and location information of all S3 objects in the region. This subsystem is necessary to serve all GET, LIST, PUT, and DELETE requests. The

View modify.sql
SELECT concat( 'ALTER TABLE ', a.table_name, ' MODIFY field_name VARCHAR(255) NOT NULL;' )
FROM information_schema.tables a
WHERE a.table_name LIKE 'foo%bar';
View gist:48b1482e64d1318a4dc429545ace43ce
1. Convert our ".jks" file to ".p12" (PKCS12 key store format):
keytool -importkeystore -srckeystore oldkeystore.jks -destkeystore newkeystore.p12 -deststoretype PKCS12
1.1. List new keystore file contents:
keytool -deststoretype PKCS12 -keystore newkeystore.p12 -list
2. Extract pem (certificate) from ".p12" keysotre file: