Skip to content

Instantly share code, notes, and snippets.

View mikepfeiffer's full-sized avatar
🏠
Working from home

Mike Pfeiffer mikepfeiffer

🏠
Working from home
View GitHub Profile
New-AzResourceGroup -Name webapps-prod-rg
New-AzAppServicePlan -ResourceGroupName webapps-prod-rg `
-Name 'gm-asp-prod-01' `
-Location westus `
-Tier s1 `
-NumberofWorkers 1
New-AzWebApp -ResourceGroupName webapps-prod-rg `
-Name 'gm-webapp-prod-01' `
#!/bin/bash
az appservice plan create \
-g webapps-dev-rg \
-n gm-asp-dev-02 \
--is-linux \
--number-of-workers 1 \
--sku S1
az webapp create \
@mikepfeiffer
mikepfeiffer / stress.sh
Created January 27, 2019 21:05
Install Stress Utility on Amazon Linux 2
sudo amazon-linux-extras install epel -y
sudo yum install stress -y
@mikepfeiffer
mikepfeiffer / apache2.sh
Created January 27, 2019 16:26
EC2 Bootstrap Script for Apache v2
#!/bin/bash
yum update -y
yum install -y httpd
instanceId=$(curl http://169.254.169.254/latest/meta-data/instance-id)
echo "<h1>Hello World from $instanceId</h1>" > /var/www/html/index.html
systemctl start httpd
systemctl enable httpd
@mikepfeiffer
mikepfeiffer / apache.sh
Created January 26, 2019 19:43
EC2 Bootstrap Script for Apache
#!/bin/bash
yum update -y
yum install -y httpd
echo '<h1>Hello World</h1>' > /var/www/html/index.html
systemctl start httpd
systemctl enable httpd
@mikepfeiffer
mikepfeiffer / app.js
Created December 26, 2018 21:12
Simple Node Demo App
const config = require('./config');
const express = require('express');
const app = express();
app.get('/', (req, res) => {
res.send('Hello World v2!');
});
app.listen(config.port, () => {
@mikepfeiffer
mikepfeiffer / Dockerfile
Created December 26, 2018 19:42
Dockerfile for a bare bones Node & Express app
FROM node:alpine
WORKDIR /usr/app
COPY package*.json ./
RUN npm install
COPY . .
CMD ["npm", "start"]
@mikepfeiffer
mikepfeiffer / processResponse.js
Created December 16, 2018 19:33
Client side code that processes the response from a demo Azure function
function processResponse(response) {
if (response.status === 200) {
output =
`
<div class="alert alert-success" role="alert">
Hello, ${document.getElementById('name').value}! It's nice to meet you!
</div>
`;
document.getElementById('output').innerHTML = output;
} else {
@mikepfeiffer
mikepfeiffer / submitMessage.js
Created December 16, 2018 19:33
Client side code that uses fetch API to submit a form
function submitMessage(e) {
e.preventDefault();
let name = document.getElementById('name').value;
fetch('<YOUR FUNCTION URL GOES HERE>', {
method: 'POST',
headers: {
'Accept': 'application/json, text/plain, */*',
'Content-type': 'application/json'
},
@mikepfeiffer
mikepfeiffer / index.html
Created December 16, 2018 19:29
Front-end for a Serverless Web App Demo on Azure
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Hello World</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M"
crossorigin="anonymous">