Skip to content

Instantly share code, notes, and snippets.

@mmaridev
mmaridev / blacklist.py
Created October 12, 2018 20:49
Python 3 script to update an ipset blacklist from postfix's log
#!/usr/bin/python3
import os
import ipaddress
import sys
DRY_RUN = "--dry-run" in sys.argv
@mmaridev
mmaridev / python3webcalculator.py
Last active October 25, 2018 16:13
Python 3 web calculator with POST
#!/usr/bin/python3
# This is a script written as homework for computer science
# (c) 2018 Marco Marinello <[email protected]>
# Import modules
from http.server import BaseHTTPRequestHandler,HTTPServer
import views
# Import settings
try:
@mmaridev
mmaridev / base.html
Last active October 27, 2018 07:44
Bootstrap 4 / Django 2.1 starter template
{% load i18n static %}
<!DOCTYPE html>
<html lang="it">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.4.1/css/all.css" integrity="sha384-5sAR7xN1Nv6T6+dT2mhtzEpVJvfS3NScPQTrOxhwjIuvcA67KV2R5Jz6kr4abQsz" crossorigin="anonymous">
@mmaridev
mmaridev / 1relazione.tex
Last active February 24, 2020 15:01
Relazione esperienza laboratoriale di fisica: Misura del valore di g locale con l'ausilio di un pendolo
% Quest'opera è stata rilasciata con licenza Creative Commons Attribuzione - Non commerciale - Condividi allo stesso modo 4.0 Internazionale. Per leggere una copia della licenza visita il sito web http://creativecommons.org/licenses/by-nc-sa/4.0/.
% dichiara tipo documento
\documentclass[a4paper]{article}
% imposta codifica caratteri
\usepackage[utf8]{inputenc}
\usepackage{makeidx}
\usepackage{graphicx}
% imposta titolo, autore e data
@mmaridev
mmaridev / index.html
Last active December 12, 2018 16:16
Chat client based on twisted/autobahn (without history)
<!DOCTYPE html>
<html lang="it">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.4.1/css/all.css" integrity="sha384-5sAR7xN1Nv6T6+dT2mhtzEpVJvfS3NScPQTrOxhwjIuvcA67KV2R5Jz6kr4abQsz" crossorigin="anonymous">
<script
@mmaridev
mmaridev / logo_keyring.scad
Created December 12, 2018 19:48
OpenSCAD Project to extrude a png logo on a circular keyring
cylinder(2, d=32);
difference() {
translate([-12,-9,-2]) {
scale(0.17,0.17,1)
surface(file="/tmp/logo.png");
}
translate([-20,-20,-3])
cube([40,40,3]);
translate([-20,-20,4])
@mmaridev
mmaridev / 000-default.conf
Created December 12, 2018 19:57
Apache Rewrite redirection to https excluding let's encrypt folder
<VirtualHost *:80>
ServerName you.example.org
ServerAlias www.you.example.org
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error_you_sezf_it.log
CustomLog ${APACHE_LOG_DIR}/access_you_sezf_it.log combined
RewriteEngine On
RewriteCond %{HTTPS} off
@mmaridev
mmaridev / settings_local.py
Created December 31, 2018 09:47
Local settings for django site with mariadb
ALLOWED_HOSTS = ["you.example.org"]
DEBUG = True
DATABASES = {
"default": {
"ENGINE": "django.db.backends.mysql",
"NAME": "",
"USER": "",
"PASSWORD": "",
@mmaridev
mmaridev / ws2.php
Created January 20, 2019 13:15
WeatherWing human variables converter
<?php
$fileaddr = "http://localhost/meteo/clientraw.txt";
$content = implode('', file ($fileaddr));
$vals = explode(" ", $content);
//Gestione della direzione del vento (da tabella5.php)
function direzioneVento ($gradi)
@mmaridev
mmaridev / django_apache.conf
Created February 24, 2019 19:52
Apache 2 configuration to run django apps
<VirtualHost *:80>
ServerName example.org
ServerAdmin [email protected]
DocumentRoot /var/www/html
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/?(.well-known)/
RewriteRule ^(.*) https://%{HTTP_HOST}%{REQUEST_URI}