Skip to content

Instantly share code, notes, and snippets.

@fsantini
fsantini / GenericInputDialog.py
Last active Jan 8, 2021
An implementation for a generic input dialog in PyQt5. String and/or numeric values can be obtained with just one line of code. See the "Testing" section at the end of the file.
View GenericInputDialog.py
"""
Generic input dialog in PyQt5.
By Francesco Santini <francesco.santini@gmail.com>
Code released in the Public Domain (CC-0)
"""
from __future__ import annotations
from typing import Any, Union
from collections import OrderedDict
@fsantini
fsantini / FBSavePic.js
Created Feb 26, 2020
Tampermonkey script to save the open Facebook image with a Ctrl-Alt-S shortcut
View FBSavePic.js
// ==UserScript==
// @name FBSavePic
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Save the open Facebook image with a Ctrl-Alt-S shortcut
// @author You
// @match https://www.facebook.com/*
// @require http://code.jquery.com/jquery-3.3.1.min.js
// @grant GM_download
// ==/UserScript==
@fsantini
fsantini / gzafferanopopup.user.js
Created Feb 22, 2019
userscript for removing the popup from Giallozafferano website
View gzafferanopopup.user.js
// ==UserScript==
// @name Giallozafferano Popup closer
// @version 1
// @grant GM_addStyle
// @include https://ricette.giallozafferano.it/*
// @include http://ricette.giallozafferano.it/*
// ==/UserScript==
// Note: disable cookie storage for giallozafferano to remove the 5-page limit!
@fsantini
fsantini / magnetic-resonance-in-medicine-webpage.csl
Created May 31, 2018
Zotero style for Magnetic Resonance in Medicine with WebPage support.
View magnetic-resonance-in-medicine-webpage.csl
<?xml version="1.0" encoding="utf-8"?>
<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="sort-only" default-locale="en-US">
<info>
<title>Magnetic Resonance in Medicine - Francesco Santini</title>
<id>https://csl.mendeley.com/styles/518147371/magnetic-resonance-in-medicine-webpage</id>
<link href="http://www.zotero.org/styles/magnetic-resonance-in-medicine" rel="self"/>
<link href="http://www.zotero.org/styles/council-of-science-editors" rel="template"/>
<link href="http://onlinelibrary.wiley.com/journal/10.1002/(ISSN)1522-2594/homepage/ForAuthors.html" rel="documentation"/>
<author>
<name>Andrew Priest</name>
@fsantini
fsantini / ISMRMProceedings.js
Last active Nov 7, 2018
Zotero translator for ISMRM Proceedings
View ISMRMProceedings.js
{
"translatorID": "64f80311-85ec-4089-ae6d-665b535fb3b3",
"label": "ISMRM Proceedings",
"creator": "Francesco Santini",
"target": "http://indexsmart.mirasmart.com/ISMRM[0-9]+/",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
@fsantini
fsantini / deleteGroup.FCMacro
Created Jan 10, 2015
FreeCAD macro for deleting a group object together with its children
View deleteGroup.FCMacro
import Part, FreeCAD, math, PartGui, FreeCADGui
from FreeCAD import Base, Console
def delWithChildren(obj):
doc = FreeCAD.ActiveDocument
for o in obj.OutList:
delWithChildren(o)
doc.removeObject(obj.Name)
sel = FreeCADGui.Selection.getSelection() # " sel " contains the items selected
@fsantini
fsantini / download.php
Created Jul 19, 2013
This page can be used as a "proxy" file download page that counts the downloads of every file storing them in a MySQL/MariaDB database.
View download.php
<?php
/* File download counter.
* This code is copyright of Francesco Santini <francesco.santini _at_ gmail.com> and can be used and distributed freely,
* provided that you cite the author, according to the Creative Commons 3.0 - Attribution (cc-by) license.
*
* This page can be used as a "proxy" file download page that counts the downloads of every file storing them in a MySQL/MariaDB database.
* Whenever you want to let the user download a specific file, say "files/arch.tgz", use the link download.php?path=files/arch.tgz.
* This can be made transparent to the user by using the .htaccess file (see below)
* To read the statistics, call the page with the parameters show=true and your password, like this: download.php?show=true&pass=page_password.
*