Skip to content

Instantly share code, notes, and snippets.

View restrepo's full-sized avatar

Diego Restrepo restrepo

View GitHub Profile
def get_institutions(q):
page=1
if q:
url=f'https://inspirehep.net/api/institutions?q={q}&size=250&page={page}'
else:
url=f'https://inspirehep.net/api/institutions?size=250&page={page}'
r=requests.get(url)
time.sleep(sleep)
i=r.json()['hits']['hits']
total=r.json().get('hits').get('total')
@article{Alloul:2013bka,
author = "Alloul, Adam and Christensen, Neil D. and Degrande,
Céline and Duhr, Claude and Fuks, Benjamin",
title = "{FeynRules 2.0 - A complete toolbox for tree-level
phenomenology}",
journal = "Comput. Phys. Commun.",
volume = "185",
year = "2014",
pages = "2250-2300",
doi = "10.1016/j.cpc.2014.04.012",
import re
def split_names(s,exceptions=['Gil', 'Lew', 'Liz', 'Paz', 'Rey', 'Rio', 'Roa', 'Rua', 'Sus', 'Zea'],
nacionality='Colombiana'):
"""
Extract the parts of the full name `s` in the format ([] → optional):
[SMALL_CONECTORS] FIRST_LAST_NAME [SMALL_CONECTORS] [SECOND_LAST_NAME] NAMES
If len(s) == 3 → Not Ibero-America name is asked
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@restrepo
restrepo / covid_lat.ipynb
Created March 25, 2020 21:57
covid_lat.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@restrepo
restrepo / COCOVID-19.ipynb
Last active March 23, 2020 23:07
Datos oficiales COVID-19 Colombia de @MinSaludCol en https://infogram.com/covid-2019-ins-colombia-1hnq41zg9ord63z
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@restrepo
restrepo / COCOVID-19.py
Created March 23, 2020 22:57
Datos oficiales COVID-19 Colombia de @MinSaludCol en https://infogram.com/covid-2019-ins-colombia-1hnq41zg9ord63z
import requests
import pandas as pd
r=requests.get('https://infogram.com/covid-2019-ins-colombia-1hnq41zg9ord63z')
head='"data":[[["ID de caso",'
tail=']]]'
js='{}{}{}'.format( head.split(':')[-1],
r.text.split(head)[-1].split(tail)[0],
tail
@restrepo
restrepo / h-index.py
Last active July 1, 2020 17:14
Simple formula to calculation of the h-index
def hIndex(citations):
"""
https://github.com/kamyu104/LeetCode/blob/master/Python/h-index.py
:type citations: List[int]
:rtype: int
# Given an array of citations (each citation is a non-negative integer)
# of a researcher, write a function to compute the researcher's h-index.
#
# According to the definition of h-index on Wikipedia:
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env bash
SARAH_VERSION=4.13.0
wget http://www.hepforge.org/archive/sarah/SARAH-${SARAH_VERSION}.tar.gz
tar zxf SARAH-${SARAH_VERSION}.tar.gz
ln -s SARAH-${SARAH_VERSION} SARAH
wget http://www.hepforge.org/archive/spheno/SPheno-4.0.3.tar.gz
tar zxf SPheno-4.0.3.tar.gz
ln -s SPheno-4.0.3 SPHENO
sed -ri 's/(^F90\s*=\s*)ifort/\1gfortran/' SPHENO/Makefile