This is just stuff that I have put down that I find I use a lot of the time for my own reference.
$ git pull
# Copyright (C) 2016 Martina Pugliese | |
from boto3 import resource | |
from boto3.dynamodb.conditions import Key | |
# The boto3 dynamoDB resource | |
dynamodb_resource = resource('dynamodb') | |
def get_table_metadata(table_name): |
var https = require('https'); | |
var util = require('util'); | |
var SLACK_CHANNEL = process.env.SLACK_CHANNEL; | |
var SLACK_PATH = process.env.SLACK_PATH; | |
exports.handler = function(event, context) { | |
console.log(JSON.stringify(event, null, 2)); | |
console.log('From SNS:', event.Records[0].Sns.Message); |
WebSockets is a modern HTML5 standard which makes communication between client and server a lot more simpler than ever. We are all familiar with the technology of sockets. Sockets have been fundamental to network communication for a long time but usually the communication over the browser has been restricted. The general restrictions
var uniqueArray = function(arrArg) { | |
return arrArg.filter(function(elem, pos,arr) { | |
return arr.indexOf(elem) == pos; | |
}); | |
}; | |
var uniqEs6 = (arrArg) => { | |
return arrArg.filter((elem, pos, arr) => { | |
return arr.indexOf(elem) == pos; | |
}); |
// create the rest API for accessing our lambdas | |
const api: apigw.RestApi = new apigw.RestApi(this, "blogs-api", { | |
description: "blogs api gateway", | |
deploy: true, | |
deployOptions: { | |
// this enables caching on our api gateway, with a ttl of five minutes (unless overridden per method) | |
cachingEnabled: true, | |
cacheClusterEnabled: true, | |
cacheDataEncrypted: true, | |
stageName: "prod", |
# This file is your Lambda function | |
import json | |
import boto3 | |
def save_to_bucket(event, context): | |
AWS_BUCKET_NAME = 'my-bucket-name' | |
s3 = boto3.resource('s3') | |
bucket = s3.Bucket(AWS_BUCKET_NAME) | |
path = 'my-path-name.txt' |
// A SO answer to https://stackoverflow.com/questions/286141/remove-blank-attributes-from-an-object-in-javascript | |
// based off the recursive cleanEmpty function by @chickens. | |
// This one can also handle Date objects correctly | |
// and has a defaults list for values you want stripped. | |
const cleanEmpty = function(obj, defaults = [undefined, null, NaN, '']) { | |
if (defaults.includes(obj)) return | |
if (Array.isArray(obj)) | |
return obj |
$ sudo npm install -g hexo-cli
$ hexo -v
hexo-cli: 0.1.9