Skip to content

Instantly share code, notes, and snippets.

View fmaida's full-sized avatar

Francesco Maida fmaida

View GitHub Profile
@fmaida
fmaida / start
Created September 7, 2016 12:47
The bin/start file I'm actually using on webfaction to start a ghost blog server
#!/bin/sh
procs=$(/home/fmaida/webapps/cesco_it_privato/bin/node /home/fmaida/webapps/cesco_it_privato/ghost/node_modules/forever/bin/forever list | grep -F /home/fmaida/webapps/cesco_it_privato/bin/node)
if [ -z "$procs" ]; then
cd /home/fmaida/webapps/cesco_it_privato/ghost
NODE_ENV=production /home/fmaida/webapps/cesco_it_privato/bin/node /home/fmaida/webapps/cesco_it_privato/ghost/node_modules/forever/bin/forever start -l ~/logs/user/cesco_it_privato-forever.log -o ~/logs/user/cesco_it_privato-stdout.log -e ~/logs/user/cesco_it_privato-stderr.log -a --sourceDir /home/fmaida/webapps/cesco_it_privato/ghost index.js
fi
@fmaida
fmaida / albatramonto.py
Last active February 18, 2019 11:14
Come calcolare gli orari di alba e tramonto per Venezia con una semplice ed efficace libreria python chiamata "suntime". Potete cambiare la città semplicemente modificando i dati di longitudine e latitudine.
from dateutil import tz
# Occhio che la librerie suntime
# va prima installata nel proprio
# computer con il comando:
# " pip install suntime "
from suntime import Sun
# Latitudine e longitudine di Venezia
latitudine = 45.4398
@fmaida
fmaida / cactus-dark.css
Last active March 30, 2020 13:38
Dark cactus theme v1.21 for micro.blog. Add this custom CSS code to your page if you are using the "Cactus" theme on micro.blog and you want to invert the colors on screen.
nav.main-nav a,
nav.main-nav a.cta,
a,
strong,
#title,
#post-list a:hover,
#post-list li:hover .dates,
#title:hover,
a, p a, #post-list.archive.readmore a {
color: #00b6e5; /* #5babf0; */
@fmaida
fmaida / dark-minos.min.css
Last active January 8, 2022 22:13
This will render your minos theme ( https://github.com/carsonip/hugo-theme-minos ) in dark colors, just remember to add customCSS = ["dark-minos.min.css"] under [parameters] in your config.toml file. You can use either the scss file and compile it, or directly the .min.css file
body{background-color:#24292e;color:#eee}#logo,.main-nav-link,a.article-title,p,#page-nav a,.archive-article-title,#main-nav-toggle,.article-entry,.article-toc li a,.tag-cloud a,.article-footer a:hover{color:#eee}a.article-title:hover,a.article-date:hover,a.archive-article-title:hover,#footer a:hover,#page-nav>a:hover,.tag-cloud a:hover,a:hover{border-bottom-color:#eee}.article-entry a{border-bottom:none}.article-entry a:hover{border-bottom:1px dotted #00b6e5}#page-nav .current{background-color:#00b6e5}a,.article-entry a,.article-more-link a,#footer-info a{color:#00b6e5}.article-nav-link-wrap{text-shadow:0 1px #222;color:#00b6e5;text-align:center}.article-nav-link-wrap:hover{color:#eee}#header{background-color:#14191e;border-bottom:1px solid #222}div.highlight,pre,.article-entry code{background-color:#14191e !important;scrollbar-color:#00b6e5 #14191e}.article,.article-date{border-bottom:1px solid #14191e}.archives{border-left:1px solid #14191e}.archive-article-inner:hover{border-left-color:#00b6e5}.article-me
@fmaida
fmaida / fifteen_puzzle.css
Created October 15, 2023 11:22
Fifteen Puzzle game done in python 3 by using the library Textual (https://textual.textualize.io)
Screen {
layout: grid;
grid-size: 4 4;
/* grid-rows: 5% 15% 80%; */
}
Tile {
width: 9;
height: 3;
color: #fff;
@fmaida
fmaida / app.py
Last active December 26, 2023 23:21
How to fetch data from a Jotform webhook with Python v3.6+ and Flask
import json
from flask import Flask, request
app = Flask(__name__)
def extract_jotform_data():
output = {}
form_data = request.form.to_dict()
@fmaida
fmaida / smolpub.py
Last active February 22, 2024 22:41
This python scripts allows to post a text file to the https://smol.pub server. Requires Python 3.7+ and the library "requests".
# Version 1.0
from pathlib import Path
from os.path import basename, isfile
import subprocess
import sys
import re
# The script needs the python library "requests". If the library
# is not found, the script will be halted
@fmaida
fmaida / __main__.toml
Last active March 11, 2024 13:09
Possiible prototipo per un formato semplice e facilmente estendibile con cui poter creare Interactive Fiction (IF). Tutte le spaziature e le tabulazioni sono completamente opzionali, e sono state inserite con l'unico scopo di rendere più semplice la lettura del codice sorgente.
# File: storia/__main__.toml
# Descrizione dello scenario
#
# * La variabile "requirements" richiede che uno o più oggetti
# indicati siano nell'inventario dell'utente, per poter
# visualizzare il testo.
# * Gli oggetti elencati possono anche
# essere preceduti da un punto esclamativo (!) per indicare
# una condizione di NOT: e cioè, che l'oggetto NON DEVE