Skip to content

Instantly share code, notes, and snippets.

View steko's full-sized avatar
💭
I may be slow to respond.

Stefano Costa steko

💭
I may be slow to respond.
View GitHub Profile
@joeroe
joeroe / tidy_rcarbon.R
Created March 5, 2019 10:45
Tidy wrappers for the rcarbon package
# tidy_rcarbon.R
# Tidy wrappers for the rcarbon package
#' Calibrate radiocarbon dates with tidy syntax
#'
#' A thin wrapper of [rcarbon::calibrate()] that returns calibrated dates as a
#' single list rather than a `CalDates`` object. Useful, for example, if you want
#' to add a column of calibrated dates to an existing table with [dplyr::mutate()]
#'
#' @param cra A vector of uncalibrated radiocarbon ages.
@StartZeroGnu
StartZeroGnu / how-to-package-jekyll-theme.md
Last active September 30, 2016 14:59
How to package a new theme for jekyll as a Rubygem, based on the official theme "minima"

How to: package a new (Rubygem) theme for jekyll v.3.2.1

How to package a new theme for Jekyll v.3.2.1 as RubyGem based on the official theme "minima 1.2" by Parker Moore.

I'm not a programmer, i'm not an experienced user of Jekyll, i'm just a hobbiest web development since March 2016

@shawngraham
shawngraham / getannotations.py
Last active August 22, 2022 18:54
extracting structured notes from PUBLIC hypothes.is annotations based on https://gist.github.com/judell/ca913dd64a29f852afd3
import requests, re, json, types, traceback
class HypothesisAnnotation:
def __init__(self, row):
"""Encapsulate relevant parts of one row of a Hypothesis API search."""
self.tags = []
if row.has_key('tags') and row['tags'] is not None:
self.tags = row['tags']
@bearfrieze
bearfrieze / comprehensions.md
Last active December 23, 2023 22:49
Comprehensions in Python the Jedi way

Comprehensions in Python the Jedi way

by Bjørn Friese

Beautiful is better than ugly. Explicit is better than implicit.

-- The Zen of Python

I frequently deal with collections of things in the programs I write. Collections of droids, jedis, planets, lightsabers, starfighters, etc. When programming in Python, these collections of things are usually represented as lists, sets and dictionaries. Oftentimes, what I want to do with collections is to transform them in various ways. Comprehensions is a powerful syntax for doing just that. I use them extensively, and it's one of the things that keep me coming back to Python. Let me show you a few examples of the incredible usefulness of comprehensions.

@steko
steko / Labs.csv
Created February 13, 2016 14:32
Radiocarbon labs codes
Code Lab Country Active
A University of Arizona USA 1
AA NSF-Ariz. AMS Facility USA 1
AAR University of Aarhus Denmark 1
AC Ingeis Argentina 1
AECV Alberta Environmental Center of Vegreville Canada 0
AERIK Atomic Energy Res. Inst. Korea 0
ALG Algiers Algeria 0
ANAS Applied Nuclear-Atomic Science (ANAS) Lab. South Korea 1
ANL Argonne Nat. Lab. USA 0
@aborruso
aborruso / Obiezione_Interruzione_Volontaria_Gravidanza_per_categoria_professionale_2012.csv
Last active January 30, 2016 18:52
Numeri sconcertanti su l'obiezione all'interruzione volontaria di gravidanza
Dove Numero ginecologi Percentuale ginecologi Numero anestetisti Percentuale anestetisti Numero personale non medico Percentuale personale non medico
ITALIA SETTENTRIONALE 1587 64.1 1491 37.6 3574 34.1
Piemonte 277 65.0 216 38.8 447 24.4
Valle d'Aosta 2 13.3 4 25.0 2 3.5
Lombardia 565 63.6 602 41.3 1221 43.1
Bolzano 69 87.3 28 40.6 168 68.0
Trento 41 67.2 31 37.3 467 24.2
Veneto 261 75.0 245 35.7 548 51.9
Friuli Venezia Giulia 73 58.4 40 30.3 158 32.6
Liguria 89 64.0 130 35.5 228 32.9
@AustinRochford
AustinRochford / Bayesian Survival analysis with PyMC3.ipynb
Last active April 10, 2022 05:02
Bayesian Survival analysis with PyMC3
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@atomotic
atomotic / gist:e0e3536b8bc14737685f
Last active August 29, 2015 14:24
quote @virnatwit

"Al fondo, vedo (non certo nei curatori del progetto, ma come sottofondo ancora presente nella mente di alcuni bibliotecari italiani), l'idea che le opere conservate in una biblioteca siano in qualche modo "possedute" dalla biblioteca. Conservare (che è la mission delle biblioteche per le opere storiche) non implica acquisire diritti, quanto piuttosto, semmai, doveri, come appunto quello della massima valorizzazione delle opere. Al giorno d'oggi questo non può che significare rilasciare anche le digitalizzazioni in pubblico dominio (o CC0)."

@ColinMaudry
ColinMaudry / gist:6fd6a5f610f0ac3e6696
Last active November 24, 2023 15:46
cURL examples to query Wikidata

SPARQL Queries (with cURL command) on Wikidata

This gist resulted to be just the spark for a proper article, and won't be maintained here anymore.

The SPARQL endpoint is http://wdqs-beta.wmflabs.org/bigdata/namespace/wdq/sparql and it has a Web form to fire queries. However http://www.wikidata.org/prop/direct/P31 ("instance of") tells you what the entity is.

The repository doesn't have named graphs, or at least the SPARQL endpoint rejects graph queries. The classes of entities (rdf:type) are not described in the repository.

To find the HTML page of an entity (such as https://www.wikidata.org/entity/Q866405), simply replace /entity/ with /wiki/.