Skip to content

Instantly share code, notes, and snippets.

View fishcharlie's full-sized avatar

Charlie Fish fishcharlie

View GitHub Profile
const bleno = require("@abandonware/bleno");
const util = require("util");
function Characteristic(pizza) {
bleno.Characteristic.call(this, {
uuid: '13333333333333333333333333330003',
properties: ['read', 'write'],
descriptors: [
new bleno.Descriptor({
uuid: '2901',
const fs = require("fs");
const crypto = require("crypto");
const path = require("path");
const args = process.argv;
const password = "hfuidagoiegw48t3goq4t8oghaw";
const filePath = path.join(__dirname, "file.txt");
console.log(Date.now());
switch (args[args.length - 1]) {
case "encrypt":
{
"Version": "2008-10-17",
"Statement": [
{
"Sid": "AllowPublicRead",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "s3:GetObject",
{
"body": "eyJ0ZXN0IjoiYm9keSJ9",
"resource": "/{proxy+}",
"path": "/path/to/resource",
"httpMethod": "POST",
"isBase64Encoded": true,
"queryStringParameters": {
"foo": "bar"
},
"pathParameters": {
@fishcharlie
fishcharlie / DynamooseAwait.js
Last active December 1, 2018 18:56
Dynamoose Promises & Await
const dynamoose = require('dynamoose');
const schema = new dynamoose.Schema({
id: Number,
name: String
});
const User = dynamoose.model('User', schema);
async function main() {
const dynamoose = require('dynamoose');
dynamoose.AWS.config.update({
region: 'us-west-2'
});
const schema = new dynamoose.Schema({
id: String,
name: String,
ts: Number
});
const Model = dynamoose.model('TestDB', schema, {
const AWS = require('aws-sdk');
AWS.config.update({
region: 'us-west-2'
});
const dynamodb = new AWS.DynamoDB();
async function main() {
const startTime = Date.now();
console.log("Start time: ", startTime);
const promiseArray = new Array(10000).fill("").map((item, index) => index).map(item => model(item));

Keybase proof

I hereby claim:

  • I am fishcharlie on github.
  • I am fishcharlie (https://keybase.io/fishcharlie) on keybase.
  • I have a public key ASBnxFVt8mu4g_bZzFkV_gpF5pDSWFYgMg8emSldYOVpeQo

To claim this, I am signing this object:

ubuntu@ip-172-31-14-240:~/code/DynamoDBBackup$ node restore.js -b rrainntestbucket -s TestDB/2017-07-06-18:33:25.gz -t TestDB2
Listing objects in bucket rrainntestbucket
Finding the most recent backup...
backup found TestDB/2017-07-06-18:33:25.gz
Uncompressing log...
Creating table TestDB2
{ MultipleValidationErrors: There were 2 validation errors:
* UnexpectedParameter: Unexpected key 'LastIncreaseDateTime' found in params.ProvisionedThroughput
* UnexpectedParameter: Unexpected key 'LastDecreaseDateTime' found in params.ProvisionedThroughput
at ParamValidator.validate (/home/ubuntu/code/DynamoDBBackup/node_modules/aws-sdk/lib/param_validator.js:40:28)
module.exports = function(app, passport) {
app.get('/', function(req, res) {
res.send("Ok");
});
}