Skip to content

Instantly share code, notes, and snippets.

View LucaLanziani's full-sized avatar

Luca Lanziani LucaLanziani

View GitHub Profile
AngularApp
.run(["$rootScope", function ($rootScope) {
$rootScope.log_http_response = function (what, callback) {
return function (data, status, headers, config) {
console.log(what, data, status, headers, config);
(callback || angular.noop)(data, status, headers, config);
};
};
$rootScope.message = function () {
var args = Array.prototype.slice.call(arguments);
(function () {
/*jshint laxcomma:true, asi:true */
'use strict';
var CONTROLLER_NAME = "MessagesCtrl";
function controller($scope, $timeout, loading) {
$scope.messages = [];
var messages_type = ["alert-info",
"alert-success",
@LucaLanziani
LucaLanziani / encrypt.html
Last active September 23, 2023 07:50
AES encryption, equivalent implementation in python (PyCrypto) and Javascript (CryptoJS)
<html>
<head>
<script src="/javascripts/CryptoJS/rollups/aes.js"></script>
<script src="/javascripts/CryptoJS/components/mode-cfb-min.js"></script>
<script src="/javascripts/encrypt.js"></script>
</head>
<body>
</body>
</html>
buf = new Buffer('SGVsbG8gV29ybGQhIQ==','base64')
fs.writeFile('file.bin', buf, function (err) { if (err) throw err;})
@LucaLanziani
LucaLanziani / local_chromium.sh
Created June 14, 2014 11:24
Allow chromium to access local files
#!/usr/bin/env bash
chromium --new-window --allow-file-access-from-files $@
var moment = require('moment');
var tomorrow = "",
nextweek = "",
nextmonth = "";
tomorrow = moment().add('days', 1).format('\\H H D M *')
nextweek = moment().add('weeks', 1).format('\\H H D M *')
nextmonth = moment().add('months', 1).format('\\H H D M *')
@LucaLanziani
LucaLanziani / delay.js
Last active August 29, 2015 14:08
underscore delay
function delay() {
var func = Array.prototype.shift.call(arguments);
var time = Array.prototype.shift.call(arguments);
var args = arguments;
var _delay = function () {
func.apply(null, args);
}
setTimeout(_delay, time);
@LucaLanziani
LucaLanziani / keybase.md
Last active December 19, 2016 15:45
To verify my identity

Keybase proof

I hereby claim:

  • I am lucalanziani on github.
  • I am nss (https://keybase.io/nss) on keybase.
  • I have a public key ASCLym-c0lsZLVZfjrbHi-OOYwcxMukJhSUH4TkUCUbORwo

To claim this, I am signing this object:

@LucaLanziani
LucaLanziani / Makefile
Last active August 29, 2015 14:16
Python project
.PHONY: TEST ENV
ENV: Makefile
virtualenv --distribute ./env
CHECK_ENV:
ifndef VIRTUAL_ENV
$(error PLEASE ENTER THE VIRTUALENV BEFORE FUN THE COMMAND)
endif
title date category tags email
Let's talk terraform
2021-04-26 21:39:00 +0200
general, terraform, devops
devops
terraform
luca@lanziani.com

I have used terraform almost daily for the past 5 years and during this time I have developed some ideas on how to use it.