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:
View ansible.md

Ansible

Ansible is a tool to automate platform changes such as deploying new app code or ensure services are installed. The Ansible application runs on both your local machine and you're remote server. There is not need for a central master - like Puppet.

A local version of the playbook is used to update your remote servers. Playbooks are similar to a Puppet Manifest.

All communication between local and remote are handled though ssh. So make sure you can ssh into your remote server from where you are.

Setup

View mysql-db-table-sizes.sql
SELECT
table_schema as `Database`,
table_name AS `Table`,
round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB`
FROM information_schema.TABLES
ORDER BY (data_length + index_length) DESC;
--- from http://stackoverflow.com/a/9620273/1478950
View multiple_ssh_setting.md

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"