Skip to content

Instantly share code, notes, and snippets.

@uorat
uorat / nginx-websocket-proxy.conf.diff
Created September 19, 2016 10:38
Nginx Reverse Proxy for WebSocket w/ SSL/TLS
--- nginx-websocket-proxy.conf.bk 2016-09-19 16:25:00.918484594 +0900
+++ nginx-websocket-proxy.conf 2016-09-19 16:52:51.863111735 +0900
@@ -3,9 +3,13 @@
}
server {
- listen 80;
+ listen 443;
server_name localhost;
@uorat
uorat / sample.html
Created September 24, 2016 13:57
Sample client code for Socket.IO w/ ALB
<html>
<head>
<title>hello node.js!</title>
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="https://your.domain.or.ip/socket.io/socket.io.js"></script>
<script>
$(document).ready(function(){
var socket = io.connect('https://your.domain.or.ip');
socket.on('connect', function() {
console.log("connect [sessid = " + socket.id + "]");
@uorat
uorat / hello-apex-project_dev.json
Created July 31, 2017 03:06
hello-apex/project_dev.json
{
"name": "hello-apex",
"description": "hello-apex: sample programs",
"memory": 128,
"timeout": 5,
"nameTemplate": "dev-{{.Project.Name}}_{{.Function.Name}}"
}
@uorat
uorat / hello-apex-project_stage.json
Created July 31, 2017 03:07
hello-apex/project_stage.json
{
"name": "hello-apex",
"description": "hello-apex: sample programs",
"memory": 128,
"timeout": 5,
"nameTemplate": "stage-{{.Project.Name}}_{{.Function.Name}}"
}
@uorat
uorat / hello-apex-project_prod.json
Created July 31, 2017 03:08
hello-apex/project_prod.json
{
"name": "hello-apex",
"description": "hello-apex: sample programs",
"memory": 128,
"timeout": 5,
"nameTemplate": "prod-{{.Project.Name}}_{{.Function.Name}}"
}
@uorat
uorat / hello-apex-golang-sample-function.json
Last active August 31, 2017 05:20
hello-apex/functions/golang-sample/function.json
{
"hooks": {
"build": "GOOS=linux GOARCH=amd64 go build -o main main.go",
"clean": "rm -f main"
}
}
@uorat
uorat / hello-apex-pip-function.json
Created August 31, 2017 05:22
hello-apex/functions/helloworld-python/functions.json
{
"runtime": "python3.6",
"hooks": {
"build": "pip install -r requirements.txt -t ."
}
}
@uorat
uorat / hello-apex-pip-requirements.txt
Last active August 31, 2017 05:24
hello-apex/functions/helloworld-python/requirements.txt
requests==2.18.2
@uorat
uorat / hello-apex-pip-site-package-functions.json
Created August 31, 2017 05:26
hello-apex/functions/helloworld-python/functions.json
{
"runtime": "python3.6",
"hooks": {
"build": "pip install -r requirements.txt -t ./site-packages"
},
"environment": {
"PYTHONPATH": "/var/runtime:/var/task/site-packages"
}
}
@uorat
uorat / hello-apex-inspect-path-main.py
Created August 31, 2017 05:29
hello-apex/functions/python-sample/main.py
from __future__ import print_function
import sys
import os
import logging
logger = logging.getLogger()
logger.setLevel(logging.INFO)
def handle(event, context):
logger.info("$ENV: " + str(os.environ))