Skip to content

Instantly share code, notes, and snippets.

View LucaLanziani's full-sized avatar

Luca Lanziani LucaLanziani

View GitHub Profile
const fs = require('fs');
const htmlparser = require('htmlparser2');
function Project(xmlConfigPath) {
var self = this;
this.xmlConfigPath = xmlConfigPath;
this.devices = {};
this.groups = {};
self.GroupAddressPrefix = [];
@LucaLanziani
LucaLanziani / Makefile
Last active July 26, 2022 12:26
Compose repo
.PHONY: compose from-code local staging production
compose = docker-compose -f compose.yaml -f
database:
${compose} local.yaml up postgres
from-code:
${compose} local.yaml up --build
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.

@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
@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 / 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);
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 / 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 $@
buf = new Buffer('SGVsbG8gV29ybGQhIQ==','base64')
fs.writeFile('file.bin', buf, function (err) { if (err) throw err;})
@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>