Skip to content

Instantly share code, notes, and snippets.

@fsantini
fsantini / deleteGroup.FCMacro
Created January 10, 2015 20:33
FreeCAD macro for deleting a group object together with its children
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 July 19, 2013 12:31
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.
<?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.
*
@fsantini
fsantini / magnetic-resonance-in-medicine-webpage.csl
Created May 31, 2018 13:59
Zotero style for Magnetic Resonance in Medicine with WebPage support.
<?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 / gzafferanopopup.user.js
Created February 22, 2019 10:40
userscript for removing the popup from Giallozafferano website
// ==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 / FBSavePic.js
Created February 26, 2020 16:05
Tampermonkey script to save the open Facebook image with a Ctrl-Alt-S shortcut
// ==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 / ismrm-pathable.user.js
Last active May 17, 2021 16:53
A Tampermonkey script to optimize the website experience of ISMRM21 virtual conference
// ==UserScript==
// @name ISMRM-Pathable
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Script to optimize the ismrm21/pathable
// @author Francesco Santini
// @match https://ismrm-smrt21.us3.pathable.com/*
// @match *://cdn.filestackcontent.com/*
// @icon https://www.google.com/s2/favicons?domain=pathable.com
// @require http://code.jquery.com/jquery-3.4.1.min.js
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 29 15:01:38 2022
@author: Francesco Santini
"""
current_frame = 0;
@fsantini
fsantini / ISMRMProceedings.js
Last active February 23, 2023 15:16
Zotero translator for ISMRM Proceedings
{
"translatorID": "64f80311-85ec-4089-ae6d-665b535fb3b3",
"label": "ISMRM Proceedings",
"creator": "Francesco Santini",
"target": "https?://(index.*mirasmart.com/ISMRM[0-9]+/(PDFfiles/)?|cds.ismrm.org/protected/.*Presentations/abstracts/|cds.ismrm.org/protected/.*Proceedings/PDFfiles/)",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
@fsantini
fsantini / GenericInputDialog.py
Last active March 23, 2023 03:42
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.
"""
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
// ==UserScript==
// @name ISMRM To Calendar
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Add calendar download links to sessions. Currently for ISMRM 2023. For other ISMRMs, the time zone needs to be adjusted!!
// @author Francesco Santini <francesco.santini@gmail.com>
// @match https://submissions.mirasmart.com/ISMRM2023/Itinerary/ConferenceMatrixEventDetail.aspx*
// @icon https://www.google.com/s2/favicons?sz=64&domain=mirasmart.com
// @icon https://www.google.com/s2/favicons?domain=pathable.com
// @require http://code.jquery.com/jquery-3.4.1.min.js