Skip to content

Instantly share code, notes, and snippets.

View benizar's full-sized avatar

Benito Zaragozí benizar

View GitHub Profile
@benizar
benizar / README.md
Last active April 3, 2023 12:09
Compresses files sharing a common prefix before the first dot in their filenames.

Group Zipping

This script allows you to compress multiple files that share a common prefix before the first dot in their filenames.

Installation

The script has the following dependencies:

  • GNU Parallel
  • tar
@benizar
benizar / README.md
Last active December 19, 2020 03:43 — forked from tarleb/highlight-author.lua
Filter to highlight some authors in the bibliography

Usage

Define bibliography and family/given name patterns in metadata:

---
bibliography: my-articles.bib
given-name-pattern: Jane
family-name-pattern: Doe
---
# Adapted from the default gromit-mpx configuration file
# In ubuntu 18.04, copy this file to $HOME/.config.
# DEFINITIONS
"red Pen" = PEN (size=5 color="red");
"green Pen" = PEN (size=5 color="green");
"blue Pen" = PEN (size=5 color="blue");
"yellow Pen" = PEN (size=5 color="yellow");
"red Marker" = "red Pen" (arrowsize=2);
@benizar
benizar / README.md
Last active February 14, 2022 18:48
Extract images and text from a list of PDF files

Execute providing a list of files

bash pdf-break-down.sh folder/*
@benizar
benizar / airbnb.r
Created June 29, 2018 22:24 — forked from t-andrew-do/airbnb.r
AirBnB Scraping Script
library(stringr)
library(purrr)
library(rvest)
#------------------------------------------------------------------------------#
# Author: Andrew Do
# Purpose: A bunch of utility functions for the main ScrapeCityToPage The goal
# is to be able to scrape up to a specified page number for a given city and
# then to store that information as a data frame. The resulting data frame will
# be raw and will require additional cleaning, but the structure is more or less
@benizar
benizar / multiple-git-pull.sh
Last active October 8, 2020 15:35
Update all git repositories under a base directory
#!/bin/bash
# Based on https://gist.github.com/douglas/1287372
# But with a couple of changes
# store the current dir
CUR_DIR=$(pwd)
# Let the person running the script know what's going on.
echo "Pulling in latest changes for all repositories..."
@benizar
benizar / multiple-git-clone.md
Last active May 3, 2024 21:45
Ubuntu post-installation script for cloning multiple git repositories.

multiple-git-clone.sh

Every time I install Ubuntu on a different computer, I need to clone again the same git repositories. This is why I use this bash script.

Usage

It clones the list of repositories to a convenient working directory in the home folder. I use the /home/git folder.

Arguments are lists of git repositories. One repo per line, one file per list. See the example:

@benizar
benizar / post-install-ubuntu-16.04.sh
Last active October 9, 2020 14:30
Ubuntu post installation script for installing some basics
#!/bin/bash
apt-get update && apt-get install -y \
build-essential \
ppa-purge \
curl \
p7zip-full \
git \
make \
brasero \
"""Calculate building floors from the Spanish Cadastre GIS files (SHP).
Once logged, data can be downloaded from https://www.sedecatastro.gob.es/
and the data specification is at
http://www.catastro.minhap.gob.es/ayuda/manual_descriptivo_shapefile.pdf
This python script is to be used in the QGIS 2.x field calculator.
The "CONSTRU" field stores volumetric data and other attributes in the form
of a structured text code. Floor numbers are in roman numerals.
As for example, "-II+IV+TZA" is a building part with two underground floors,
SELECT *, true AS resid FROM usos5 WHERE usos5.id_2009 IN (SELECT id_2009 FROM usos5
WHERE (xpath('//COBERTURA[@ID="EDF" and @Sup>20]/@ID', xml_2009::xml))[1]::text='EDF'
OR (xpath('//COBERTURA[@ID="UCS" and @Sup>20]/@ID', xml_2009::xml))[1]::text='UCS'
OR (xpath('//COBERTURA[@ID="UEN" and @Sup>20]/@ID', xml_2009::xml))[1]::text='UEN'
OR (xpath('//COBERTURA[@ID="UDS" and @Sup>20]/@ID', xml_2009::xml))[1]::text='UDS'
OR (xpath('//COBERTURA[@ID="TCO" and @Sup>20]/@ID', xml_2009::xml))[1]::text='TCO'
OR (xpath('//COBERTURA[@ID="TCH" and @Sup>20]/@ID', xml_2009::xml))[1]::text='TCH')
UNION
SELECT *, false AS resid FROM usos5 WHERE usos5.id_2009 NOT IN (SELECT id_2009 FROM usos5
WHERE (xpath('//COBERTURA[@ID="EDF" and @Sup>20]/@ID', xml_2009::xml))[1]::text='EDF'