Skip to content

Instantly share code, notes, and snippets.

View codeluggage's full-sized avatar
🌏
Alleviating systemic poverty, adapting to global warming, figuring out parenting

Matias Forbord codeluggage

🌏
Alleviating systemic poverty, adapting to global warming, figuring out parenting
View GitHub Profile
@codeluggage
codeluggage / .zshrc
Last active November 19, 2022 23:04
Somewhat sensible .zshrc for those using Oh-My-Zsh, iTerm2, Android Studio, Xcode, and general git work.
export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="robbyrussell"
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
@codeluggage
codeluggage / services.yml
Created July 24, 2017 15:01
Kubernetes Nginx Loadbalancer Service
annotations:
service.beta.kubernetes.io/aws-load-balancer-backend-protocol: “https”
service.beta.kubernetes.io/aws-load-balancer-ssl-cert: “arn:aws:iam::ABCDE:server-certificate/www_yourwebsite_com”
service.beta.kubernetes.io/aws-load-balancer-ssl-ports: “443”
service.beta.kubernetes.io/aws-load-balancer-connection-draining-enabled: “true”
service.beta.kubernetes.io/aws-load-balancer-connection-draining-timeout: “60”
@codeluggage
codeluggage / services.yml
Created July 24, 2017 15:04
Full Kubernetes Nginx Service
apiVersion: v1
kind: Service
metadata:
name: nginx
annotations:
service.beta.kubernetes.io/aws-load-balancer-backend-protocol: “https”
service.beta.kubernetes.io/aws-load-balancer-ssl-cert: “arn:aws:iam::ABCDE:server-certificate/www_yourwebsite_com”
service.beta.kubernetes.io/aws-load-balancer-ssl-ports: “443”
service.beta.kubernetes.io/aws-load-balancer-connection-draining-enabled: “true”
service.beta.kubernetes.io/aws-load-balancer-connection-draining-timeout: “60”
@codeluggage
codeluggage / autoscalers.yml
Created July 24, 2017 15:05
Full Horizontal Pod Autoscaler
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
name: php-fpm
namespace: {{STACK_NAME}}
spec:
scaleTargetRef:
kind: Deployment
name: php-fpm-{{STACK_NAME}}
minReplicas: {{NUM_PHP}}
@codeluggage
codeluggage / es6ToNightwatch.js
Last active October 22, 2021 04:47
Convert ES6 classes to basic Javascript objects to export for Nightwatch
'use strict';
/*
* The purpose of this function is to convert an ES6 class to either:
* 1) A test suite if it has "tests" as a property
* 2) A page object with optional "elements", "commands" and "url"
* @param es6Class The actual class object (not instance of the class) to convert
*/
module.exports = function(es6Class) {
let properties = Object.getOwnPropertyNames(es6Class.prototype);
import os
def hello(event, context):
return {
"statusCode": 200,
"body": "The answer is: " + os.environ["THE_ANSWER"]
}
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'mydjangoproject',
'USER': os.environ.get('DB_USER', 'postgres'),
'PASSWORD': os.environ.get('DB_PASSWORD'),
'HOST': os.environ.get('DB_HOST', 'localhost'),
'PORT': os.environ.get('DB_PORT', 5432),
}
}
plugins:
- serverless-wsgi
- serverless-python-requirements
functions:
hello:
environment: ${self:custom}
handler: handler.hello
events:
- http: ANY /
- http: ANY {proxy+}
functions:
migrate:
environment: ${self:custom.variables}
handler: migrate.handler