Skip to content

Instantly share code, notes, and snippets.

version: '3.2'
secrets:
portainer-pass:
external: true
services:
agent:
image: portainer/agent:latest
volumes:
- /var/run/docker.sock:/var/run/docker.sock
@mattiarossi
mattiarossi / oci-vcn-ipv6-create.sh
Last active February 17, 2022 17:07
Create OCI IPV6 VCN
#!/bin/bash
#
tenancy_id=`cat /etc/oci/config | grep tena | uniq | cut -d "=" -f 2`
oci iam compartment list --output table --query "data [*].{CompartmentName:\"name\", OCID:id}"
read -p "Enter the compartment ID where you wish to create the VCN [$tenancy_id]: " compartment_id
compartment_id=${compartment_id:-$tenancy_id}
read -p "Enter the VCN name you wish to create [CLI-VCN]: " vcn_name
vcn_name=${vcn_name:-CLI-VCN}
echo selected VCN name : $vcn_name
vcn_dns=`echo "${vcn_name//[_-]/}"`
@mattiarossi
mattiarossi / getMarketplaceImageId
Created May 18, 2020 20:46
Fetches an OCI Marketplace listing resource id
#!/bin/bash
#FortiGate Next-Gen Firewall (BYOL)
export STERM="$1"
#6.4.0
export SVERSION="$2"
export REGION="uk-london-1"
---
title: "Statistiche Covid 2020 - Italia"
output:
html_document: default
pdf_document: default
---
```{r setup, include=FALSE}
requiredPackages <- c("readr", "dplyr", "ggplot2", "ggthemes", "scales", "extrafont", "knitr")
{
"variables": {
"user_ocid":"{{env `user_ocid`}}",
"tenancy_ocid": "{{env `tenancy_ocid`}}",
"fingerprint":"{{env `fingerprint`}}",
"private_key_path":"{{env `private_key_path`}}",
"availability_domain": "{{env `availability_domain`}}",
"region": "{{env `region`}}",
"base_image_ocid": "{{env `base_image_ocid`}}",
"compartment_ocid": "{{env `compartment_ocid`}}",
#!/usr/bin/python
# -*- coding: utf-8 -*-
# @Author: mattiarossi
# @Date: 2016-03-27 23:29:25
# @Last Modified by: mattiarossi
# @Last Modified time: 2016-03-28 23:25:55
import time
import threading
import minimalmodbus
#include <ESP8266WiFi.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <PubSubClient.h>
//Def
#define HVAC_TOSHIBA_DEBUG; // Un comment to access DEBUG information through Serial Interface
#define ONE_WIRE_BUS 10 // DS18B20 on arduino pin10 corresponds to SD3 on ESP8266 Dev Board
#define NUMROOMS 5
@mattiarossi
mattiarossi / totalSize
Created December 9, 2013 08:48
Shell script to find total file sizes using a certain pattern
ls -l `find . -name \*.mp3` | awk '{ x += $5 } END { print "total MB:" x/(1024*1024) }'
@mattiarossi
mattiarossi / pulsecounter_simulator
Created October 6, 2013 21:55
A simple sketch to simulate multiple pulse counters using analog outputs 0-5 of an arduino
#define triggerDelay 90
#define channels 6
#define ppw 1
int pins[channels] = {A0,A1,A2,A3,A4,A5};
int wattshour[channels]={6000,5000,4000,3000,2000,1000};
int pulseStatus[channels]={0};
unsigned long pulseInterval[channels]={0};
@mattiarossi
mattiarossi / Iboard_Emoncms_pinchange_power.ino
Last active March 30, 2017 10:50
Uses an arduino and the pinchangeint library to implement an energy monitor that reads pulses from a power meter that has an open collector pulse output like the Finder 7E.23.8.230.0001: http://www.findernet.com/media/series/7E/EN/S7EEN.pdf Logs power readings to an emoncms instance (http://www.emoncms.org)
/*
Many meters have pulse outputs, including electricity meters: single phase, 3-phase,
import, export.. Gas meters, Water flow meters etc
The pulse output may be a flashing LED or a switching relay (usually solid state) or both.
In the case of an electricity meter a pulse output corresponds to a certain amount of
energy passing through the meter (Kwhr/Wh). For single-phase domestic electricity meters
(eg. Elster A100c) each pulse usually corresponds to 1 Wh (1000 pulses per kwh).