Skip to content

Instantly share code, notes, and snippets.

Valerio Coltrè colthreepv

Block or report user

Report or block colthreepv

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@colthreepv
colthreepv / Dockerfile-context
Created Apr 13, 2018
Inspect docker context
View Dockerfile-context
FROM alpine
RUN apk --no-cache add ncdu
COPY . /tmp/context
ENTRYPOINT ncdu /tmp/context
@colthreepv
colthreepv / Dockerfile
Last active Feb 17, 2019
Concourse CI inside Docker compose v2
View Dockerfile
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 / nginx-lang.lua
Last active Jan 30, 2016 — forked from mauron85/nginx-lang.lua
Detect preferred language script for Nginx written in LUA
View nginx-lang.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 / retry.js
Created Sep 11, 2015
angular forever $http retry
View retry.js
'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 / catchall.nginx
Created Aug 29, 2015
Catchall rule for NGINX, it does not reply to requests outside of your server domains.
View catchall.nginx
server {
listen 80;
return 444;
}
@colthreepv
colthreepv / index.js
Created Jul 18, 2015
Recursively include files and convert paths to camelCase
View index.js
// 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 / another.yml
Last active Aug 29, 2015
Bug with sudo in ansible-pull 1.9.0.1
View another.yml
---
- name: trying to create a directory that requires sudo
file:
state=directory
path=/helloworld
# sudo should not be required there!
- name: removing it
file:
state=absent
@colthreepv
colthreepv / prerender-upstart.conf
Created Mar 13, 2015
Example upstart script to use with prerender-server https://prerender.io/
View prerender-upstart.conf
description "<description here>"
author "<author@email.com>"
start on filesystem or runlevel [2345]
stop on shutdown
# Automatically Respawn:
respawn
respawn limit 3 5
@colthreepv
colthreepv / tools.js
Last active Aug 29, 2015
NodeList to Array
View tools.js
// credits to: http://stackoverflow.com/questions/3199588/fastest-way-to-convert-javascript-nodelist-to-array
function toArray (nl) {
var l=nl.length, arr = new Array(l);
while(l--){arr[l]=nl[l];}
return arr;
}
View bench-dd.sh
#!/bin/bash
echo time sh -c "dd if=/dev/zero of=ddfile bs=8k count=1000000 && sync"
echo dd if=/dec/zero of=ddfile2 bs=8K count=500000
echo time dd if=ddfile of=/dev/null bs=8k
You can’t perform that action at this time.