- To create ssh secret:
oc create secret generic sshsecret \
--from-file=ssh-privatekey=$HOME/.ssh/id_rsa
Here's a list of mildly interesting things about the C language that I learned mostly by consuming Clang's ASTs. Although surprises are getting sparser, I might continue to update this document over time.
There are many more mildly interesting features of C++, but the language is literally known for being weird, whereas C is usually considered smaller and simpler, so this is (almost) only about C.
struct foo {
struct bar {
int x;
const Moment = require('moment')
const array = [{date:"2018-05-11"},{date:"2018-05-12"},{date:"2018-05-10"}]
const sortedArray = array.sort((a,b) => new Moment(a.date).format('YYYYMMDD') - new Moment(b.date).format('YYYYMMDD'))
console.log(sortedArray)
This cheat sheet provides a detailed overview of the exposed lifecycle events and available commands (and entrypoints) of the Serverless framework, that can be hooked by plugins (internal and external ones). The document is structured by the commands invoked by the user.
Lifecycle events are shown as the globally available outer events (all providers) and sub lifecycle events that are provider specific in the called order. Currently only the AWS provider is shown. If you have information about the other provider,
function getLambdaEventSource(event) { | |
if (event.Records && event.Records[0].cf) return 'isCloudfront'; | |
if (event.configRuleId && event.configRuleName && event.configRuleArn) return 'isAwsConfig'; | |
if (event.Records && (event.Records[0].eventSource === 'aws:codecommit')) return 'isCodeCommit'; | |
if (event.authorizationToken === "incoming-client-token") return 'isApiGatewayAuthorizer'; | |
if (event.StackId && event.RequestType && event.ResourceType) return 'isCloudFormation'; |
#!/bin/bash | |
# wrapper around "aws cloudformation" CLI to ignore certain pseudo-errors | |
# aws cloudformation deploy exits with 255 for "No changes to deploy" see: https://github.com/awslabs/serverless-application-model/issues/71 | |
# this script exits with 0 for that case | |
STDERR=$(( aws cloudformation "$@" ) 2>&1) | |
ERROR_CODE=$? | |
echo ${STDERR} 1>&2 |
// there are many json-schema validators available, I prefer ajv | |
let Ajv = require('ajv') | |
let ajv = Ajv({ allErrors:true }) | |
let swagger = require('./docs/my-swagger-definition') | |
// validation middleware | |
let validateSchema = (parameters) => { | |
return (req, res, next) => { | |
let errors = [] | |
parameters.map(param => { |