Skip to content

Instantly share code, notes, and snippets.

@thedewpoint
thedewpoint / resize_and_upload_task.js
Created April 24, 2016 20:04
Image manipulation and upload to S3
/**
* Created by daniel on 9/29/2015.
*/
var AWS = require('aws-sdk');
AWS.config.update({accessKeyId: 'ID', secretAccessKey: 'KEY'});
AWS.config.update({region: 'us-east-1'});
var s3 = new AWS.S3();
var fileType = require('file-type');
var lwip = require('lwip');
var uuid = require('node-uuid');
@ka7eh
ka7eh / leaflet_to_pdf.html
Created April 12, 2016 16:55
An example for converting Leaflet maps to PDF using leaflet-image and jsPDF
<html>
<head>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css"/>
<style>
#mapid{
height: 480px;
}
#download {
position:absolute;
@HaNdTriX
HaNdTriX / toDataUrl.js
Last active February 18, 2021 20:02
Example of converting a file to a dataURL in ES6
const toDataURL = url => fetch(url)
.then(response => response.blob())
.then(blob => new Promise((resolve, reject) => {
const reader = new FileReader()
reader.onloadend = () => resolve(reader.result)
reader.onerror = reject
reader.readAsDataURL(blob)
}))
@sammachin
sammachin / db2s3.py
Created January 27, 2016 10:45
Dropbox to S3 image upload
import dropbox
import tinys3
import tempfile
from string import Template
import random
import string
S3_ACCESS_KEY = ""
S3_SECRET_KEY= ""
@woloski
woloski / payment.html
Last active October 1, 2020 15:46
Stripe Checkout + webtask
<button class="pay">Pay</button>
<script src="https://checkout.stripe.com/checkout.js">
<script>
var handler = StripeCheckout.configure({
key: window.STRIPE_PUBLICK_KEY,
image: 'https://yourlogo.png',
locale: 'auto',
token: function(token) {
$('.pay').prop("disabled", true);
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" type="text/css" href="http://app.englishpatient.org/assets/css/semantic.min.css">
@zeynepsu
zeynepsu / index.js
Last active March 14, 2018 09:18
Algorithmia NodeJS SDK
/*
* Algorithmia Lambda Sample Code
*/
var AWS = require('aws-sdk');
var apiKey = 'YOUR_API_KEY_HERE'
exports.handler = function (event, context) {
// Specify the target algorithm
var algo = "algo://besirkurtulmus/quadtree_art/0.1.x";
@gene1wood
gene1wood / all_aws_lambda_modules_python.md
Last active December 3, 2025 19:18
AWS Lambda function to list all available Python modules for Python 2.7 3.6 and 3.7
@jice-lavocat
jice-lavocat / imageSyncing.js
Last active May 6, 2022 05:18
AWS Lambda - S3 : Thumbnail creation
// dependencies
var async = require('async');
var path = require('path');
var AWS = require('aws-sdk');
var gm = require('gm').subClass({
imageMagick: true
});
var util = require('util');
// get reference to S3 client
var s3 = new AWS.S3();
@Marak
Marak / imageResize.js
Last active July 31, 2019 19:04
hook.io example microservice for resizing images
module['exports'] = function imageResize (hook, callback) {
// GraphicsMagick fully supported
var gm = require('gm');
// for a more complete example that supports file uploads and streaming uploads
// see: http://image.resize.hook.io
// grab an image as a url
// no file has been uploaded, fallback to the image "url" parameter
var stream = hook.open('https://hook.io/img/robotcat.png');
hook.res.writeHead(200, { 'Content-Type': 'image/png' });
gm(stream)