Skip to content

Instantly share code, notes, and snippets.

View espinielli's full-sized avatar

Enrico Spinielli espinielli

View GitHub Profile
@pudquick
pudquick / brew.md
Last active April 6, 2024 21:42
Lightly "sandboxed" homebrew on macOS

brew is a bad neighbor

This isn't a guide about locking down homebrew so that it can't touch the rest of your system security-wise.

This guide doesn't fix the inherent security issues of a package management system that will literally yell at you if you try to do something about "huh, maybe it's not great my executables are writeable by my account without requiring authorization first".

But it absolutely is a guide about shoving it into its own little corner so that you can take it or leave it as you see fit, instead of just letting the project do what it likes like completely taking over permissions and ownership of a directory that might be in use by other software on your Mac and stomping all over their contents.

By following this guide you will:

  • Never have to run sudo to forcefully change permissions of some directory to be owned by your account
library(rayshader)
library(sf)
library(ggmap)
library(EAlidaR)
# ------------ User Inputs ---------------------------------
# Googple maps API KEY
register_google(key = "[PUT YOUR API KEY HERE!!]") # Create your own key as shown in the ggmap documentation: https://github.com/dkahle/ggmap
# WGS84 lat Long centroid location for your scene...
@h-a-graham
h-a-graham / CityOfLondonRayshade.R
Created November 8, 2020 09:54
An R script showing how to create a 3D night-time scene of the 'City of London' borough with {EAlidaR } and {Rayshader}
# An R script showing how to create a 3D night-time scene of the 'City of London' borough with {EAlidaR } and {Rayshader}
# If you don't already have the {EAlidaR package} Run:
# devtools::install_github('h-a-graham/EAlidaR')
library(EAlidaR)
library(raster)
library(sf)
library(tidyverse)
library(here)
@rveciana
rveciana / .block
Last active February 9, 2022 09:43
Svelte mapping: circles
licence: mit
@dumbledore
dumbledore / mount-bitlocker
Created February 20, 2018 21:05
Mount/umount wrapper for dislocker on MacOS
#!/bin/bash
BITLOCKER_PARTITION="${1}"
BITLOCKER_PASSWORD="${2}"
function usage() {
echo "$(basename ${0}) <partition> <password>"
echo "Unlocks and mounts a bitlocker partition as read-only"
}
if [ -z "${BITLOCKER_PARTITION}" ]
@umidjons
umidjons / youtube-dl-download-audio-only-on-best-quality.md
Last active March 9, 2024 07:54
Download Audio from YouTube with youtube-dl

Download Audio from YouTube

-i - ignore errors

-c - continue

-t - use video title as file name

--extract-audio - extract audio track

@cpsievert
cpsievert / europe.R
Last active December 1, 2017 23:05 — forked from halhen/europe.R
library(tidyverse)
library(plotly)
# I'm being lazy, please don't do this
# setwd("~/Downloads/Version 2_0_1/")
d <- read_csv('GEOSTAT_grid_POP_1K_2011_V2_0_1.csv') %>%
rbind(read_csv('JRC-GHSL_AIT-grid-POP_1K_2011.csv') %>%
mutate(TOT_P_CON_DT = '')) %>%
mutate(
# data from http://ec.europa.eu/eurostat/web/gisco/geodata/reference-data/population-distribution-demography/geostat
# Originally seen at http://spatial.ly/2014/08/population-lines/
# So, this blew up on both Reddit and Twitter. Two bugs fixed (southern Spain was a mess,
# and some countries where missing -- measure twice, submit once, damnit), and two silly superflous lines removed after
# @hadleywickham pointed that out. Also, switched from geom_segment to geom_line.
# The result of the code below can be seen at http://imgur.com/ob8c8ph
library(tidyverse)
# Converting coordinates from DMS or DdM formats to decimal
# DMS = "degrees minutes seconds"; DdM = "degrees decimal minutes"
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dg2dec <- function(varb, Dg=NA, Min=NA, Sec=NA, SW.Hemisphere="S|W") {
# Dg=decimal, Min=minutes and Sec=seconds;
# NOTE 1 - if the format is "degrees decimal minutes - DdM" (e.g. 40° 26.767′ N) and not
# "degrees minutes seconds - DMS" (e.g. 40° 26′ 46″ N), then call the function only with
# Dg and Min arguments, like dg2dec(varb, Dg="°", Min="′N").
# Same applies when there is no seconds symbol (e.g. 45°12'7.38).
# Note that one should not use blank spaces in Dg, Min or Sec arguments (will return NA).
@hrbrmstr
hrbrmstr / phantomjs.R
Created December 29, 2014 15:29
Scraping gnarly sites with phantomjs & rvest
library(rvest)
# example of using phantomjs for scraping sites that use a twisty maze
# of javascript to render HTML tables or other tags
# grab phantomjs binaries from here: http://phantomjs.org/
# and stick it somehere PATH will find it
# this example scrapes the user table from: