Skip to content

Instantly share code, notes, and snippets.

View blindman2k's full-sized avatar

Aron Steg blindman2k

View GitHub Profile
@blindman2k
blindman2k / download_all_lambda_functions.sh
Created April 1, 2020 11:14
Download all AWS Lambda functions in the account
# Serially download all aws-lambda functions
# Assumes you have ran `aws configure` or have the AWS_DEFAULT_PROFILE variable set
# Works with "aws-cli/1.16.72 Python/3.6.7 Linux/4.15.0-42-generic botocore/1.12.62"
mkdir -p lambda_functions
for fn in $(aws lambda list-functions --output text --query "Functions[*].FunctionName" | xargs);
do
echo "Downloading function $fn ..."
aws lambda get-function --function-name $fn --output text --query 'Code.Location' | xargs wget -q --show-progress -O ./lambda_functions/$fn.zip
done
@blindman2k
blindman2k / timer.class.nut
Created November 22, 2016 11:34
Squirrel timer class with all the bells and whistles
// =============================================================================
class Timer {
self = null;
cancelled = false;
paused = false;
running = false;
callback = null;
interval = 0;
params = null;
@blindman2k
blindman2k / AWSDynamoDB.class.nut
Last active August 29, 2016 01:36
AWSRequestV4 and AWSDynamoDB
/**
* This class can be used to interact with a Amazon DynamoDB table
*
* @author Aron Steg <[email protected]>
*
* @version 0.0.1
*/
class AWSDynamoDB {
static version = [0, 0, 2];
The MIT License (MIT)
Copyright (c) 2016 Electric Imp
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@blindman2k
blindman2k / LICENSE
Last active February 15, 2016 05:00
GoogleMaps Class for Electric Imp
The MIT License (MIT)
Copyright (c) 2015 Electric Imp
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
// Copyright (c) 2015 Initial State Technologies, Inc.
// This file is licensed under the MIT License
// http://opensource.org/licenses/MIT
class InitialState {
static version = [1,0,0];
_bucketKey = null;
_accessKey = null;
@blindman2k
blindman2k / spiflashfs.device.nut
Last active January 18, 2016 14:53
Updated SPI Flash File System with 4kb pages and no lookup tables or indices, just data pages with small headers.
/*
The physical space is divided into blocks (64k) and sectors (16k).
Erase (wiping 0's to 1's) is performed at the sector level.
The file system divides the available space into pages which the size of one or more sectors.
At the start of every spage is an header which contains:
- the file's id (two bytes) for identifying and rejoining parts of a file
- the span id (two bytes) for ordering the parts
- an optional filename (with length byte)
- the span's size (how much of the page is used)
@blindman2k
blindman2k / README.md
Last active August 29, 2015 14:23
SPIFlash - A new SPI flash class designed to be fully compatible with hardware.spiflash (https://electricimp.com/docs/api/hardware/spiflash/)
@blindman2k
blindman2k / README.md
Last active August 29, 2015 14:23
SPIFlashLogger class - Uses a provided SPI flash class or the imp003+'s built-in SPI flash class to turn part of the SPI flash into a rotating log (first in, first out) of serialised objects.

SPI Flash Logger class

Introduction

The SPI Flash Logger class manages all or a portion of a SPI flash (either via imp003+'s built-in SPI flash driver or any functionally compatible driver) and turns it into an logger. It will log any serialisable object (table, array, string, blob, integer, float, boolean and null) and when it reaches the end of the available space it will override the oldest data first.

NOR-flash technology

#require "Rocky.class.nut:1.1.1"
class RockyII extends Rocky {
function _addAccessControl(res) {
res.header("Access-Control-Allow-Origin", "*")
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
res.header("Access-Control-Allow-Methods", "POST, PUT, GET, OPTIONS, PATCH, DELETE");
res.header("Access-Control-Expose-Headers", "X-ImpBase-Version");
}
}