Skip to content

Instantly share code, notes, and snippets.

View matthewoestreich's full-sized avatar
♠️
👋

Matt Oestreich matthewoestreich

♠️
👋
View GitHub Profile
@matthewoestreich
matthewoestreich / Dockerfile
Created April 30, 2019 21:13
Example Dockerfile for Vue.js and NGINX
# build stage
FROM node:lts-alpine AS build-stage
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
# production stage
# - this line was throwing errors, something is up with Jenkins Docker plugin -
// Change time zone
System.setProperty('org.apache.commons.jelly.tags.fmt.timeZone', 'America/Chicago')
@matthewoestreich
matthewoestreich / nginx.conf
Last active May 4, 2019 06:31
Docker and NGINX for Vue History Mode
server {
listen 80 default_server;
listen [::]:80 default_server;
root /usr/share/nginx/html;
index index.html;
location / {
# Support the HTML5 History mode of the vue-router.
@matthewoestreich
matthewoestreich / mongo-docker.sh
Last active May 4, 2019 15:47 — forked from davideicardi/mongo-docker.bash
Running mongodb inside a docker container (with mongodb authentication)
# Create a container from the mongo image,
# run is as a daemon (-d), expose the port 27017 (-p),
# set it to auto start (--restart)
# and with mongo authentication (--auth)
# Image used is https://hub.docker.com/_/mongo/
docker pull mongo
docker run --name YOURCONTAINERNAME --restart=always -d -p 27017:27017 mongo mongod --auth
# Using the mongo "localhost exception" (https://docs.mongodb.org/v3.0/core/security-users/#localhost-exception)
# add a root user
@matthewoestreich
matthewoestreich / Dockerfile
Last active August 22, 2020 00:11
Dockerfile / traefik.toml / docker-compose.yml
FROM node:lts-alpine AS build-stage
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
FROM nginx:stable-alpine
COPY --from=build-stage /app/dist /usr/share/nginx/html
# this isn't necessary - you don't have to expose a port here
@matthewoestreich
matthewoestreich / Jenkinsfile.node.mocha.groovy
Created June 8, 2019 19:07
Sample Jenkinsfile that passes env variables into Jenkins so Mocha can run tests
node {
def app
def dockerhub_container = "oze4/node-api"
def local_container_name = "node-api"
def docker_compose_path = "/srv/traefik/docker-compose/"
stage('Clone Repository') {
deleteDir()
checkout scm
}
function Set-ADSIUser
{
<#
.SYNOPSIS
This function modifies an account identified by its display name, sam account name or distinguished name.
.DESCRIPTION
This function modifies an account identified by its display name, sam account name or distinguished name.
.PARAMETER Identity
@matthewoestreich
matthewoestreich / index.html
Created June 26, 2019 23:23
Vue - get public IP and Latitude - separate components
<div id="app">
<div>
<current-ip @ip-changed="$set(ips, 'first', $event)"></current-ip>
<current-latitude :ip="ips['first']"></current-latitude>
<hr />
<current-ip
ip="4.2.2.2"
@ip-changed="$set(ips, 'second', $event)"></current-ip>
<current-latitude :ip="ips['second']"></current-latitude>
</div>
# instantiate it
getVeeamLinks = lambda z: {dic["Type"] : dic["Href"] for dic in z for key in dic.keys() if key == 'Type'}
# invoke it
allLinks = getVeeamLinks(lod) # where 'lod' is your list of dicts
print(allLinks)
// CORS middleware function (this will allow any host to be able to send requests)
function allowCors(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
next();
}