Skip to content

Instantly share code, notes, and snippets.

Run go install and

  • gogitlocalstats -add /path/to/folder will scan that folder and its subdirectories for repositories to scan
  • gogitlocalstats -email [email protected] will generate a CLI stats graph representing the last 6 months of activity for the passed email. You can configure the default in main.go, so you can run gogitlocalstats without parameters.

Being able to pass an email as param makes it possible to scan repos for collaborators activity as well.

License: CC BY-SA 4.0

@edipretoro
edipretoro / zotero-rdf-tags.py
Created January 11, 2025 08:57 — forked from rlskoeser/zotero-rdf-tags.py
Python script to generate CSV summary data from a Zotero RDF library export
#! /usr/bin/env python
# simple script to pull data from a Zotero library RDF export
# and generate a CSV file with identifier, type of item, title,
# date, and the number of tags
#
# Only supports book and bookSection item types, all other items are ignored
#
# The CSV file will be generated with the same base name as the
# RDF input file.
@edipretoro
edipretoro / gist:530417e582d5d58aac6b5086cef593fa
Created September 19, 2024 05:56 — forked from prin-underlandscape/gist:7cb81c5b0231c58691a1181da1e7bf67
How to embed dynamic Zotero bibliographies in Google Sites

How to embed dynamic Zotero bibliographies in Google Sites

This document explains how to embed in a Google Sites page a bibliography generated dynamically starting from a Zotero public library. The case of a private library is more complex and is not covered here. This tutorial is based on the official library in [https://www.zotero.org/support/dev/web_api/v3/basics](official documentation).

We cover cases in which embedding does not require javascript code, but just writing a HTTP URL that leverages the API of the Zotero bibliography service. The URL is then embedded into the Google Sites page using the embed button (the one represented by two brackets <>) in the Google Sites graphical user interface. We are using this method to write the bibliography of the https://sites.google.com/view/prin-underlandscape project web site (at draft stage when writing this gist).

Getting the user id and the first API request

The fist operation on our way is to find the User Identifier for

<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
@edipretoro
edipretoro / init.el
Last active June 19, 2023 19:32
Starting point for an Emacs configuration
(require 'package)
(setq package-enable-at-startup nil)
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/"))
(package-initialize)
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
@edipretoro
edipretoro / lis_advent_calendar-recsys.py
Created December 6, 2020 20:47
A basic recommendation system based on loans data
from math import sqrt
import json
import pathlib
import pprint
def fill_resources(patrons):
all_resources = {}
for patron in patrons:
for resource, rating in patrons[patron].items():
@edipretoro
edipretoro / unimarc2anki.py
Created June 27, 2020 19:12
Simple CLI to produce an Anki deck about UNIMARC
#!/usr/bin/env python
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker, Session
from unimarc2anki.db import Field, SubField
import genanki
import random
model_id = random.randrange(1 << 30, 1 << 31)
model = genanki.Model(
@edipretoro
edipretoro / sim_unimarc_records.py
Created June 21, 2020 09:11
Simple CLI to compute similarities between bibliographic records.
#!/usr/bin/env python
"""Simple CLI to compute similarities between bibliographic records."""
from typing import Callable, Iterable, Tuple
import jellyfish as jf
import pymarc
import pathlib
import argparse
#!/usr/bin/env python
import requests
import hashlib
import json
operations_log = {}
headers = {
"Cache-Control": "no-cache",
@edipretoro
edipretoro / some_records.mrc
Last active January 30, 2017 21:25
A very minimal UTF-8 ISO2709 file containing 2 UNIMARC records
01626cam 2200349 450 001002100000003004700021010003500068020001700103073001800120100004100138101000800179102000700187105001800194106000600212200013700218210009200355215004500447225002300492300006700515300001000582410005800592606005400650676002300704686007000727700004700797701003600844701003600880702003600916801007000952930011601022930013801138FRBNF423141140000009http://catalogue.bnf.fr/ark:/12148/cb42314114d a978-2-7440-2419-1bbr.d22 EUR aFRb01102691 0a9782744024191 a20101109d2010 m y0frey50 ba0 afre aFR a||||z 00|y| ar1 aPerl modernebTexte impriméfSébastien Aperghis-Tramoni, Damien Krotkine, Jérôme Quelingavec la contribution de Philippe Bruhat aPariscPearson éducation Francedimpr. 2010e63-Clermont-FerrandgImpr. la Source d'or a1 vol. (XVIII-445 p.)ccouv. ill.d19 cm| aLe guide de survie aLa couv. porte en plus : "l'essentiel des pratiques actuelles" aIndex 0040971782tLe Guide de survie (Paris)x1955-9992d2010 312490649aPerl (langage de