Skip to content

Instantly share code, notes, and snippets.

View thenayr's full-sized avatar

Ryan vanniekerk thenayr

View GitHub Profile
@thenayr
thenayr / grafana-curl-commands.sh
Last active February 12, 2024 14:54
Create annotations in Grafana using Curl
# Curl command to create new annotation
curl -H "Content-Type: application/json" -X POST \
-d '{"tags":["deployment","Environment"],"text":"$serviceName was deployed to $environment with commit ID $commitID"}' \
http://grafana.qa.lonelyplanet.com/api/annotations
# Response
HTTP/1.1 200
Content-Type: application/json
{"message":"Annotation added"}
@thenayr
thenayr / Makefile
Created April 4, 2017 19:16
Docker container communication over same network example
NGINX_CONTAINER_NAME := nginx-test
NGINX_CONTAINER_IMAGE := nginx:1.11.12-alpine
TOOLBOX_CONTAINER_NAME := docker-toolbox
TOOLBOX_CONTAINER_IMAGE := sjourdan/toolbox
NETWORK := test-network
.PHONY : check clean
check:
-@ docker network create $(NETWORK)
@thenayr
thenayr / Dockerfile
Last active February 23, 2017 22:37
Basic Node NPM Dockerfile
FROM node:6.9.5
RUN mkdir -p /code
WORKDIR /code
ADD . /code
RUN npm set progress=false && \
npm install -s --no-progress && \
npm run build && \
npm prune --production
CMD [ "npm", "start" ]
EXPOSE 3000
@thenayr
thenayr / Dockerfile
Created February 23, 2017 15:57
Simple Dockerfile for Alpine Node 6.3.5 with Yarn
FROM node:6.9.5-alpine
RUN mkdir -p /code
WORKDIR /code
ADD . /code
RUN npm install -g -s --no-progress yarn && \
yarn && \
yarn run build && \
yarn run prune && \
yarn cache clean
CMD [ "yarn", "start" ]
@thenayr
thenayr / Dockerfile
Created February 23, 2017 15:30
Simple Dockerfile for Node 6.9.5 with Yarn
FROM node:6.9.5
RUN mkdir -p /code
WORKDIR /code
ADD . /code
RUN npm install -g -s --no-progress yarn && \
yarn && \
yarn run build && \
yarn run prune && \
yarn cache clean
CMD [ "npm", "start" ]
@thenayr
thenayr / Dockerfile
Created February 22, 2017 22:35
Simple Dockerfile for Node 6.9.5 alpine
FROM node:6.9.5-alpine
RUN mkdir -p /code
WORKDIR /code
ADD . /code
RUN npm set progress=false && \
npm install -s --no-progress && \
npm run build && \
npm prune --production
CMD [ "npm", "start" ]
EXPOSE 3000
@thenayr
thenayr / start.sh
Created February 22, 2017 18:54
A small script to bootstrap and run our app
#!/bin/bash -l
set -e
echo "BUILDING APP"
npm run build
node prodServer
@thenayr
thenayr / Dockerfile
Created February 22, 2017 18:46
Node 6.9.5 base image with NPM
FROM node:6.9.5
RUN mkdir -p /code
WORKDIR /code
ADD . /code
RUN npm install
CMD [ "npm", "run", "start" ]
EXPOSE 3000
@thenayr
thenayr / chef-server.rb
Last active January 19, 2017 18:51
Chef server 11 non-ssl compatibility
# From https://tickets.opscode.com/browse/CHEF-4029
lb['api_fqdn'] = "chef.example.com"
nginx['enable_non_ssl'] = true
nginx['non_ssl_port'] = 4000
nginx['ssl_port'] = 443
@thenayr
thenayr / Pod.js
Created November 19, 2016 22:05
Code to reset the sphere colliders on the vive controllers
componentDidMount() {
// Fun hack to make physics and grab register newly added objects
[].slice.call(document.querySelectorAll('.controllers')).forEach((el) => el.removeAttribute('sphere-collider'));
[].slice.call(document.querySelectorAll('.controllers')).forEach((el) => el.setAttribute('sphere-collider', 'objects: .pod;'));
// [].slice.call(document.querySelectorAll('.controllers')).forEach((el) => el.components['sphere-collider'].update);
// Enable physics on the appended object
ReactDom.findDOMNode(this.refs.pod).setAttribute('dynamic-body', '');
}