Skip to content

Instantly share code, notes, and snippets.

View colthreepv's full-sized avatar

valerio coltre colthreepv

View GitHub Profile
@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 / guake-start.sh
Last active July 2, 2019 08:31
guake script to startup with tabs.
#!/bin/bash
# guake-start.sh
guake --rename-tab="home" &
sleep 3
guake --new-tab=2 --rename-tab="projects" --execute-command="cd ~/projects" &
sleep 1
guake --new-tab=3 --rename-tab="develop" --execute-command="cd ~/projects" &
sleep 1
guake --new-tab=4 --rename-tab="git" --execute-command="cd ~/projects" &
sleep 1
@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
@colthreepv
colthreepv / angular-throttle.js
Last active January 10, 2018 12:07
throttle function for AngularJS. Original one: https://github.com/cowboy/jquery-throttle-debounce
angular.module('helperFunctions', [])
.factory('throttle', ['$timeout', function ($timeout) {
return function (delay, no_trailing, callback, debounce_mode) {
var timeout_id,
last_exec = 0;
if (typeof no_trailing !== 'boolean') {
debounce_mode = callback;
callback = no_trailing;
no_trailing = undefined;
@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 / app.js
Created November 25, 2013 13:01
Example of /user route of angular-login-example made in ExpressJS
/**
* Example true backend for angular-login-example
*/
var express = require('express');
var http = require('http');
var path = require('path');
var app = express();
// from https://github.com/mrgamer/angular-login-example/blob/master/src/mockhttp.js#L51-L58
@colthreepv
colthreepv / menu.lst
Created November 18, 2013 17:43
ubuntu 12.04.3 LTS booting from Grub4DOS
title Ubuntu 12.04.3
find --set-root /ubuntu-12.04.3-desktop-amd64.iso
map /ubuntu-12.04.3-desktop-amd64.iso (hd32) || map --mem /ubuntu-12.04.3-desktop-amd64.iso (hd32)
map --hook
root (hd32)
kernel /casper/vmlinuz.efi file=/cdrom/preseed/ubuntu.seed boot=casper iso-scan/filename=/ubuntu-12.04.3-desktop-amd64.iso
initrd /casper/initrd.lz
savedefault --wait=2
@colthreepv
colthreepv / .editorconfig
Last active December 26, 2015 23:19
personal .editorconfig for js projects! AWESOME!
# EditorConfig is awesome: http://editorconfig.org/
# Please, read it!
# top-most EditorConfig file
root = true
[*]
charset = utf8
end_of_line = lf
indent_style = space
@colthreepv
colthreepv / chunked.js
Last active December 26, 2015 12:59
tail -f webserver version, using chunked responses (HTTP 1.1) http://goo.gl/4VuKS6
/**
* tail -f webserver version, using chunked responses (HTTP 1.1)
* slides: http://goo.gl/4VuKS6
*/
var fs = require('fs'),
util = require('util'),
http = require('http');
http.createServer(function (req, res) {
fs.stat(req.url, function (err, stats) {