Skip to content

Instantly share code, notes, and snippets.

@wookets
wookets / curler.sh
Created September 10, 2019 15:33
Curler
url="https://java-appdynamics.domain.com/"
for ((i=1;i<=50;i++)); do
curl -k ${url}
done
@wookets
wookets / Dockerfile
Created September 10, 2019 15:30
Node api dockerfile
# first stage builds typescript
FROM mhart/alpine-node:12 AS build
WORKDIR /app
COPY . .
RUN npm ci
RUN npm run build
# second stage creates slim down packages
FROM mhart/alpine-node:12 AS cull
WORKDIR /app
@wookets
wookets / nginx.conf
Created September 10, 2019 15:19
Nginx: static vuejs conf
server {
listen 8080;
location / {
root /usr/share/nginx/html;
try_files $uri $uri/ /index.html;
}
}
@wookets
wookets / Dockerfile
Created September 10, 2019 15:18
Docker: Multi-stage build dockerfile vuejs
# first stage builds vue
FROM mhart/alpine-node:12 as build-stage
WORKDIR /app
COPY . .
RUN npm ci
RUN npm run build
# second stage copies only the static dist files to nginx html dir
FROM nginx:stable-alpine as production-stage
VOLUME /var/log/nginx
# https://medium.com/@caulfieldOwen/youre-missing-out-on-a-better-mac-terminal-experience-d73647abf6d7
# install homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# install iterm2
brew cask install iterm2
# install zsh
brew install zsh zsh-completions
@wookets
wookets / log.js
Created May 29, 2014 19:21
winston log.js wrapper
var winston = require('winston');
function getLogger(module) {
var path = module.filename.split('/').slice(-2).join('/'); //using filename in log statements
return new winston.Logger({
transports : [
new winston.transports.Console({
colorize: true,
level: 'debug',
@wookets
wookets / logger-example.coffee
Last active January 3, 2016 09:09
A running logger for node.js. This logger will record events
logger = require 'logger'
log = logger.create()
log('START :: Starting a fun job!')
log('Some event happened and I have attached data.', data)
logs = log('END :: A fun job is over!')
console.log(logs)
#
# output
@wookets
wookets / example.coffee
Created November 25, 2013 19:34
Executing a coffeescript file with heroku scheduler
#
# 1. Put this file in {app}/scripts directory
# 2. Deploy on to Heroku
# 3. Add the Heroku Scheduler add-on
# 4. Add Job with task $ coffee scripts/example.coffee
#
console.log 'hello world'
@wookets
wookets / config.coffee
Last active December 27, 2015 18:49
Multi tenant simple config for node.js. Based on TJ's config gist.
#
# Server config (based on tenant config)
#
# load the config from root of project
config = require __dirname + '/../../config.json'
#
# Apply defaults to every tenant up front to make things easier later.
#
@wookets
wookets / app.ctrl.coffee
Last active December 12, 2015 04:58
AngularJS Mixins - By passing a scope to a mixin you can keep your controllers simple and reuse mixin code through out your app.
window.AppCtrl = ($scope, $route, $timeout) ->
# mixins
mixin_generic($scope) # setup $scope.generic()
# now we can...
$scope.generic()