Skip to content

Instantly share code, notes, and snippets.

@tylermakin
tylermakin / ec2-ftp-tutorial.md
Last active Apr 3, 2021
Tutorial for configuring FTP access to an EC2 server
View ec2-ftp-tutorial.md
@ericoporto
ericoporto / forkMyself.md
Last active Jul 17, 2017
How to fork my own github repository.
View forkMyself.md
  1. create a new repository in Github, don't add a readme or anything.

  2. clone it on your computer

  3. add the original repository (the one you want to fork) as upstream source.

    git remote add upstream [url]

  4. fetch and merge upstream.

@rcknr
rcknr / README.md
Last active Jul 19, 2018
Using Let's Encrypt certificates with Amazon API Gateway
View README.md

##Using Let's Encrypt certificates with AWS API Gateway

Before starting off with API Gateway set up it's worth mentioning that certificate configuration for this particular service is so far isn't well integrated, therefore different from other AWS services. Despite it using CloudFrount to serve on custom domains it won't let you customize distributions it creates, however all the limitations of CloudFront naturally apply to API Gateway. The most important in this case is the size of the key, which is limited by 2048 bit. Many tutorials provide ready to use terminal commands that have the key size preset at 4096 bit for the sake of better security. This won't work with API Gateway and you'll get an error message about certificate's validity or incorrect chain which won't suggest you the real cause of the issue. Another consideration is that to add a custom domain to API Gateway you have to have a certif

View awslambdasample.js
console.log('Loading event');
var AWS = require('aws-sdk');
var dynamodb = new AWS.DynamoDB();
exports.handler = function(event, context) {
console.log("Request received:\n", JSON.stringify(event));
console.log("Context received:\n", JSON.stringify(context));
var tableName = "OurBlogDemo";
var datetime = new Date().getTime().toString();
@gunjanpatel
gunjanpatel / amazon-ec2-ftp.md
Last active Mar 25, 2021
amazon ec2 LAMP and FTP installation and setup
View amazon-ec2-ftp.md
@jonaslejon
jonaslejon / Mailgun PHP API with curl
Last active Sep 6, 2019
Send mail with Mailgun API version 2 and PHP. Should also work with version 3 of the Mailgun API
View Mailgun PHP API with curl
define("DOMAIN", "test.se");
define("MAILGUN_API", "XXX123"); // Mailgun Private API Key
function br2nl($string) {
return preg_replace('/\<br(\s*)?\/?\>/i', "\n", $string);
}
function mg_send($to, $subject, $message) {
$ch = curl_init();
@kmaida
kmaida / convert-UNIX-timestamp.js
Last active Feb 9, 2021
Convert a UNIX timestamp to user's local time via JavaScript
View convert-UNIX-timestamp.js
function convertTimestamp(timestamp) {
var d = new Date(timestamp * 1000), // Convert the passed timestamp to milliseconds
yyyy = d.getFullYear(),
mm = ('0' + (d.getMonth() + 1)).slice(-2), // Months are zero based. Add leading 0.
dd = ('0' + d.getDate()).slice(-2), // Add leading 0.
hh = d.getHours(),
h = hh,
min = ('0' + d.getMinutes()).slice(-2), // Add leading 0.
ampm = 'AM',
time;
@dhavaln
dhavaln / camera.html
Created Mar 29, 2012
Phonegap Camera Capture Example
View camera.html
<!DOCTYPE html>
<html>
<head>
<title>Capture Photo</title>
<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1"/>
<script type="text/javascript" charset="utf-8" src="js/phonegap.js"></script>
<script type="text/javascript" charset="utf-8">
var pictureSource; // picture source
var destinationType; // sets the format of returned value