Skip to content

Instantly share code, notes, and snippets.

View leopoldodonnell's full-sized avatar

Leo O'Donnell leopoldodonnell

View GitHub Profile
@leopoldodonnell
leopoldodonnell / Dockerfile
Last active April 29, 2021 15:25
EventStore Performance Monitor Tool
FROM node:14-alpine
ENV RW_CONNECTION="esdb://host.docker.internal:2113?Tls=false"
COPY ./ ./
RUN npm install
ENTRYPOINT [ "npx", "ts-node", "es-ratewatch.ts" ]
@leopoldodonnell
leopoldodonnell / APlaceToStart.md
Last active July 15, 2021 19:43
Nestjs Startup

Nestjs In Under 15 Minutes

If you've got 15 minutes to spare and have docker installed, this Gist will get you started with a working debuggable Nestjs application using Docker with additional settings for vscode. Clearly you'll want to dig deeper, but this is a start...

Nestjs is a popular nodejs for typescript framework for building microservices. It enjoys a large active community, has many extensions and is easily extended. Documentation can be found here

Create the basic file structure from the Github Gist

@leopoldodonnell
leopoldodonnell / Readme.md
Last active April 9, 2024 07:44
Install and run Postgres with an extension using docker-compose

Local Postgres

This gist is an example of how you can simply install and run and extended Postgres using docker-compose. It assumes that you have docker and docker-compose installed and running on your workstation.

Install

  • Requires docker and docker-compose
  • Clone via http: git clone https://gist.github.com/b0b7e06943bd389560184d948bdc2d5b.git
  • Make load-extensions.sh executable
  • Build the image: docker-compose build
@leopoldodonnell
leopoldodonnell / Dockerfile
Created February 27, 2018 15:17
Go Dockerfile with SNYK
# A Dockerfile to build a go app with Snyk testing
FROM golang:alpine3.7 AS builder
MAINTAINER 'Leo ODonnell'
# Build with your SNYK Token, but supply from command line
ARG SNYK_TOKEN=xxxxxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
# Pass in the name of the application to build
ARG APP=your-app
@leopoldodonnell
leopoldodonnell / background.sh
Created February 8, 2018 11:09
A Bourne Shell script that will run a command in the background and will send it a SIGTERM when it is received
#!/bin/sh
#
# The script demonstrates how to terminate a background process. It will run
# the process and wait till a SIGTERM signal is received, then it will pass that
# along to the background process and return its status.
#
# Syntax: background.sh command-line
#
pid=0
@leopoldodonnell
leopoldodonnell / Dockerfile
Last active February 8, 2018 13:45
Docker Hardening for Alpine
FROM alpine:3.6
# A hardened base image for Alpine
# You can build this with different users and home directories
ARG SERVICE_USER
ARG SERVICE_HOME
# Default to user 'app' with home '/home/app'
ENV SERVICE_USER ${SERVICE_USER:-app}
ENV SERVICE_HOME ${SERVICE_HOME:-/home/${SERVICE_USER}}
@leopoldodonnell
leopoldodonnell / k8s-cheat-sheet
Created December 13, 2016 13:59
Kubectl tricks etc
# Display all pods including IP info
kubectl get pods --all-namespaces --show-all -o wide
# Display all of the running containers
kubectl get pods -o jsonpath={.items[*].spec.containers[*].image} --all-namespaces --show-all |tr ' ' '\n' |sort -u
# Get the nodeport for a service - find a jsonpath way
servicename=`kubectl get svc some-service`
kubectl describe service $servicename |awk '$1 == "NodePort:" {sub(/\\/TCP/, "", $NF); print $NF}'
@leopoldodonnell
leopoldodonnell / monkey-patch.rb
Last active August 29, 2015 14:14
Monkey Patch a class without polluting the namespace and methods in a class
class ClassToMonkeyPatch
old_method = instance_method(:patched_method)
define_method(:patched_method) do |arg1, arg2, &block|
do_some_stuff
# delegate the rest to the old version of the method
res = old_method.bind(self).(arg1, arg2, &block)
end
end
@leopoldodonnell
leopoldodonnell / core-classes.sass
Created January 16, 2012 16:33
SASS from LESS Classes
/*
* A SASS conversion by Leo O'Donnell ( http://github.com/leopoldodonnell ) of the excellent work by Jeffrey Way
* @see http://net.tutsplus.com/tutorials/html-css-techniques/quick-tip-never-type-a-vendor-prefix-again/
* @see http://snipplr.com/view/47181/less-classes/
*/
@mixin border-radius( $radius: 3px )
-webkit-border-radius: $radius
-moz-border-radius: $radius
border-radius: $radius