Skip to content

Instantly share code, notes, and snippets.

View colthreepv's full-sized avatar

valerio coltre colthreepv

View GitHub Profile
@colthreepv
colthreepv / index.js
Created July 18, 2015 16:36
Recursively include files and convert paths to camelCase
// Recursively include files and convert paths to camelCase
var bulk = require('bulk-require');
exports = module.exports = bulk(__dirname, ['./!(index|_*|*.spec).js']);
Object.keys(exports).forEach(function (key) {
var camelCased = key;
camelCased = camelCased.replace(/-([a-z])/g, function (g) {
return g[1].toUpperCase();
});
if (camelCased !== key) {
exports[camelCased] = exports[key];
@colthreepv
colthreepv / catchall.nginx
Created August 29, 2015 14:25
Catchall rule for NGINX, it does not reply to requests outside of your server domains.
server {
listen 80;
return 444;
}
@colthreepv
colthreepv / retry.js
Created September 11, 2015 21:57
angular forever $http retry
'use strict';
var retryForever = true;
var retryTimeout = 5000;
exports = module.exports = function ($http, $q, $timeout) {
function httpRetry () {
var args = arguments;
var httpPromise = $http.apply(null, args);
@colthreepv
colthreepv / nginx-lang.lua
Last active January 30, 2016 08:58 — forked from mauron85/nginx-lang.lua
Detect preferred language script for Nginx written in LUA
-------------------------------------------------------------------------------
-- HTTP Accept-Language header handler --
-- @originalAuthor: f.ghibellini@gmail.com --
-- @originalRepository: https://github.com/fghibellini/nginx-http-accept-lang--
-- @modifiedBy: marian.hello@mapilary.com --
-- @gist: https://gist.github.com/mauron85/47ed1075262d9e020fe2 --
-- @license: MIT --
-- @requires: --
-- @description: --
-- returns language with greatest quality --
@colthreepv
colthreepv / Dockerfile
Last active February 6, 2020 06:55
Concourse CI inside Docker compose v2
FROM alpine:latest
RUN apk update && apk upgrade && \
apk add --no-cache \
openssh
RUN mkdir -p /keys/web /keys/worker
CMD ssh-keygen -t rsa -f /keys/web/tsa_host_key -N '' && \
ssh-keygen -t rsa -f /keys/web/session_signing_key -N '' && \
@colthreepv
colthreepv / Dockerfile-context
Created April 13, 2018 08:02
Inspect docker context
FROM alpine
RUN apk --no-cache add ncdu
COPY . /tmp/context
ENTRYPOINT ncdu /tmp/context