Skip to content

Instantly share code, notes, and snippets.

View mehuled's full-sized avatar
🎯
Focusing

Mehul Sharma mehuled

🎯
Focusing
View GitHub Profile
@mehuled
mehuled / redshift-generate-ddl-view.sql
Last active April 24, 2020 04:57
Redshift DDL Generation without Encoding & Sort Key Styles.
--CREATE THE VIEW TO GENERATE DDL
-- Orginal DDL courtesy : https://github.com/awslabs/amazon-redshift-utils/blob/master/src/AdminViews/v_generate_tbl_ddl.sql
CREATE OR REPLACE VIEW admin.v_generate_tbl_ddl
AS
SELECT
table_id
,REGEXP_REPLACE (schemaname, '^zzzzzzzz', '') AS schemaname
@mehuled
mehuled / classification.md
Last active February 28, 2021 17:58
23 Popular Design patterns and their abstract definitions
Scope Creational Structural Behavioral
Class Factory Method Interpreter
Template Method
Object Abstract FactoryBuilderPrototypeSingleton AdapterBridgeCompositeDecoratorFacadeProxy Chain Of ResponsiblityCommandIteratorMediatorMementoFlyweightObserver
@mehuled
mehuled / docker-compose.yml
Created April 14, 2024 12:31
simple docker-compose to run kong locally
services:
postgres:
image: postgres:13
restart: always
environment:
POSTGRES_USER: kong
POSTGRES_PASSWORD: kong
POSTGRES_DB: kong
ports:
- "5432:5432"
FROM kong/kong:latest
-- If you're not sure your plugin is executing, uncomment the line below and restart Kong
-- then it will throw an error which indicates the plugin is being loaded at least.
--assert(ngx.get_phase() == "timer", "The world is coming to an end!")
---------------------------------------------------------------------------------------------
-- In the code below, just remove the opening brackets; `[[` to enable a specific handler
--
-- The handlers are based on the OpenResty handlers, see the OpenResty docs for details
-- on when exactly they are invoked and what limitations each handler has.
local typedefs = require "kong.db.schema.typedefs"
local PLUGIN_NAME = "add-header"
local schema = {
name = PLUGIN_NAME,
fields = {
-- the 'fields' array is the top-level entry with fields defined by Kong
FROM kong/kong:latest
# Ensure any patching steps are executed as root user
USER root
RUN apt-get update
RUN apt-get install -y git curl
RUN mkdir -p /usr/local/kong/plugins
FROM kong/kong:latest
# Ensure any patching steps are executed as root user
USER root
RUN apt-get update
# Add custom plugin to the image
RUN mkdir -p /usr/local/kong/plugins
function plugin:access(plugin_conf)
package.cpath = package.cpath .. ';/usr/local/emmy/?.so'
local dbg = require('emmy_core')
dbg.tcpListen('localhost', 9966)
-- Wait for IDE connection
dbg.waitIDE()
-- your custom code here
function plugin:access(plugin_conf)
_G.emmy = {}
_G.emmy.fixPath = function(path)
return string.gsub(path, '/usr/local/kong/plugins/', '/{path_to_working_directory}/')
end
package.cpath = package.cpath .. ';/usr/local/emmy/?.so'
local dbg = require('emmy_core')
dbg.tcpListen('localhost', 9966)