Skip to content

Instantly share code, notes, and snippets.

View pmoghaddam's full-sized avatar

Payam Moghaddam pmoghaddam

  • Vancouver, Canada
View GitHub Profile
@pmoghaddam
pmoghaddam / bot-stack.ts
Created August 31, 2022 03:57
Slack bot in CDK
/**
* _Complete_ example of a Slackbot
*/
export class DemoSlackbotStack extends cdk.Stack {
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
// Secrets created separately
const secret = secretsmanager.Secret.fromSecretNameV2(this, "secrets", "DemoSlackBot" );
@pmoghaddam
pmoghaddam / 3tier-stack.ts
Last active August 31, 2022 03:54
Demo CDK stack that puts API calls into queue, and processes the queue with a Lambda.
export class CdkStack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
/**
* SPA
* Uses https://www.npmjs.com/package/cdk-spa-deploy
*/
new SPADeploy(this, 'SPA')
.createSiteFromHostedZone({
@pmoghaddam
pmoghaddam / .dockerignore
Created October 24, 2017 16:53 — forked from davidderus/.dockerignore
Docker + Rails + Puma + Postgres + Nginx
.git
.gitignore
/doc
.yardoc
coverage
jsdoc
/tmp
/log
Dockerfile
Dockerfile.prod
@pmoghaddam
pmoghaddam / elasti_cache.rb
Last active February 29, 2016 00:37
ElastiCache Example
class ElastiCache
#
# Our connection to the AWS region.
# @return [AWSConnection] The AWS connection to the region in which this ElastiCache resides.
#
attr_reader :aws
#
# Unique identifier of ElastiCache cluster
# @return [String] name associated to the ElastiCache cluster
@pmoghaddam
pmoghaddam / config_accessor.rb
Created May 16, 2015 06:48
Sample Metaprogramming
module ConfigAccessor
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
# Assumes config will be accessible like an attribute
def config_accessor(config, attr)
# Define reader
define_method(attr) do
@pmoghaddam
pmoghaddam / slack.go
Created May 3, 2015 13:42
Practice Integration with Slack
package main
import (
"fmt"
"github.com/google/go-querystring/query"
"io/ioutil"
"net/http"
)
// Change constants for yourself
@pmoghaddam
pmoghaddam / complex-output.txt
Last active August 29, 2015 14:16
simple-option-parser
$ ruby complex.rb -h
Usage: complex.rb [options]
Specific options:
-z, --zero ZERO Enforce argument ZERO
-o, --one ONE Require argument ONE
-t, --two [TWO] This is a multi-line description for
option TWO
-r, --three THREE Float argument THREE
-f, --four FOUR List of arguments for argument FOUR: [:a, :b, :c]