Skip to content

Instantly share code, notes, and snippets.

View alsonkemp's full-sized avatar
💭
Stuff or something...

Alson Kemp alsonkemp

💭
Stuff or something...
View GitHub Profile
ALB to/from Lambda (not sure it handles QS params very well yet).
```typescript
// LARGELY DERIVED FROM:
// https://github.com/vendia/serverless-express/blob/b4e21350e26b94013ad15ec780e26375664c4583/src/event-sources/utils.js
import { Stream } from 'stream';
// eslint-disable-next-line import/no-unresolved
import { ALBEvent, ALBResult } from 'aws-lambda/trigger/alb';
import { Request } from 'express';
@alsonkemp
alsonkemp / gist:00a2e55281da3ac03f4e
Last active March 4, 2016 21:19
aws_cloudformation_stack doesn't seem to be interpolating the template_body
resource "aws_cloudformation_stack" "app_cloudfront" {
name = "app_cloudfront"
# This is rendered to the template_body with the quotes removed:
# ${template_file.web_app_cloudfront.rendered}
template_body = "${template_file.web_app_cloudfront.rendered}"
}
resource "template_file" "web_app_cloudfront" {
template = "${file("./templates/web_apps_cloudfront.template")}"
@alsonkemp
alsonkemp / limit-incoming.sh
Created December 17, 2015 21:26
Limit incoming BW on interface
#!/bin/sh -x
modprobe ifb
modprobe sch_fq_codel
modprobe act_mirred
modprobe sch_netem
## Paths and definitions
tc=/sbin/tc
ext=eth5 # Change for your device!
@alsonkemp
alsonkemp / gist:2837604
Created May 30, 2012 16:55
Heroku settings overrides
# the usual settings.py above here
import urlparse
# Register database schemes in URLs.
urlparse.uses_netloc.append('postgres')
# Heroku overrides
try:
# Check to make sure DATABASES is set in settings.py file.
# If not default to {}
@alsonkemp
alsonkemp / gist:2837575
Created May 30, 2012 16:52
Disabling heroku settings.py injection
mkdir .heroku
touch .heroku/injection_disabled
git add .heroku/injection_disabled
git commit -m "grrrr...."
git push
@alsonkemp
alsonkemp / gist:2837467
Created May 30, 2012 16:32
Heroku settings.py additions
# END MY SETTINGS.PY
import os
import sys
import urlparse
# Register database schemes in URLs.
urlparse.uses_netloc.append('postgres')
urlparse.uses_netloc.append('mysql')
# standard constructor
Test1: constructor =>
this.test = "test"
Test1.prototype.testFunction: =>
print("It works!")
return null
t = new Test1()
t.testFunction()