- Recipes
- Anonymous GET access
- Anonymous GET access - match HTTP referrer
- Full access for specific IAM user/role
- GET/PUT/DELETE access to specific path within a bucket
- Restricted LIST & PUT/DELETE access to specific path within a bucket
- Full access (and S3 console) for specific IAM users
- Bucket and object delete deny
- CloudTrail log receive
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A few settings | |
$image = 'cricci.jpg'; | |
// Read image path, convert to base64 encoding | |
$imageData = base64_encode(file_get_contents($image)); | |
// Format the image SRC: data:{mime};base64,{data}; | |
$src = 'data: '.mime_content_type($image).';base64,'.$imageData; | |
// Echo out a sample image |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function listToMatrix(list, elementsPerSubArray) { | |
var matrix = [], i, k; | |
for (i = 0, k = -1; i < list.length; i++) { | |
if (i % elementsPerSubArray === 0) { | |
k++; | |
matrix[k] = []; | |
} | |
matrix[k].push(list[i]); | |
} | |
return matrix; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | |
/** | |
* fixes chmod issues | |
* | |
* @author Mike Funk | |
* @email mfunk@christianpublishing.com | |
* | |
* @file MY_Log.php | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const express = require('express'); | |
const app = express(); | |
const multer = require('multer'); | |
const multerS3 = require('multer-s3'); | |
const AWS = require('aws-sdk'); | |
const s3 = new AWS.S3({ | |
accessKeyId: 'access-key-id', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Number.prototype.formatMoney = function(places, symbol, thousand, decimal) { | |
places = !isNaN(places = Math.abs(places)) ? places : 2; | |
symbol = symbol !== undefined ? symbol : "$"; | |
thousand = thousand || ","; | |
decimal = decimal || "."; | |
var number = this, | |
negative = number < 0 ? "-" : "", | |
i = parseInt(number = Math.abs(+number || 0).toFixed(places), 10) + "", | |
j = (j = i.length) > 3 ? j % 3 : 0; | |
return symbol + negative + (j ? i.substr(0, j) + thousand : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + thousand) + (places ? decimal + Math.abs(number - i).toFixed(places).slice(2) : ""); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
p.id as "Pool Id", | |
p.status, | |
p.province_id, | |
CASE | |
WHEN province_id = 11 THEN "Aceh" | |
WHEN province_id = 12 THEN "Sumatera Utara" | |
WHEN province_id = 13 THEN "Sumatera Barat" | |
WHEN province_id = 14 THEN "Riau" | |
WHEN province_id = 15 THEN "Jambi" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var jstz = function() { | |
var b = function(a) { | |
a = -a.getTimezoneOffset(); | |
return null !== a ? a : 0 | |
}, c = function() { | |
return b(new Date(2010, 0, 1, 0, 0, 0, 0)) | |
}, f = function() { | |
return b(new Date(2010, 5, 1, 0, 0, 0, 0)) | |
}, e = function() { | |
var a = c(), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getUrlVars() { | |
var vars = {}; | |
var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) { | |
vars[key] = value; | |
}); | |
return vars; | |
} | |
/// http://hengkiardo.com/index.php?id=123&page=home |
Template that will create the following:
- API Gateway endpoint:
- A single root method, accepting
POST
requests only with Lambda proxy integration to a function.
- A single root method, accepting
- In-line Lambda function echoing back requesting users IP address to API Gateway requests:
- IAM role for Lambda allowing CloudWatch logs access.
- Permissions for Lambda that allow API Gateway endpoint to successfully invoke function.
- CloudWatch logs group for Lambda, with 90 day log retention.
After standing up the template, you should be able to curl a POST
request to the URL listed as the apiGatewayInvokeURL
output value.
NewerOlder