Skip to content

Instantly share code, notes, and snippets.

View robsalasco's full-sized avatar
☀️
Enjoying life

Roberto Salas robsalasco

☀️
Enjoying life
View GitHub Profile
@trinker
trinker / Map Sparkline
Created March 5, 2017 22:50
Map sparkline
p_load(ggplot2, fivethirtyeight, dplyr, gridExtra)
data("police_deaths")
police_deaths_count <- police_deaths %>% arrange(state, -year) %>% group_by(state, year) %>% count()
police_deaths_count <- police_deaths_count %>% arrange(state, -year) %>%
filter(year %in% c(1970:2015) & !state %in% c("AK", "HI", "US", "GU", "MP", "PR", "RR", "TR", "VI"))
# Create unique blank strip labels for empty facets
bl = sapply(1:37, function(n) paste(rep(" ",n),collapse=""))
@urschrei
urschrei / png_to_polygon_to_geojson.py
Last active November 16, 2022 16:58
Read a PNG into a numpy array, convert it to a Shapely Polygon, and dump it as GeoJSON
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created by Stephan Hügel on 2017-03-02
The MIT License (MIT)
Copyright (c) 2017 Stephan Hügel
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# download 4 songs from http://www.bensound.com/
library("seewave", lib.loc="~/R/win-library/3.3")
library(tuneR)
song1<-readWave("C:/Users/Donkey Kong/Desktop/bensound-dubstep.wav")
song2<-readWave("C:/Users/Donkey Kong/Desktop/bensound-cute.wav")
song3<-readWave("C:/Users/Donkey Kong/Desktop/bensound-epic.wav")
song4<-readWave("C:/Users/Donkey Kong/Desktop/bensound-acousticbreeze.wav")
@Andrew-Reid
Andrew-Reid / index.html
Last active April 16, 2020 17:25
d3v4 Multiple Pie Charts on Map - Data from CSV
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<style>
svg {
background: #9ecae1;
}
.mesh {
fill:none;
@troeger
troeger / minecraft-server
Last active April 5, 2023 17:22
Running a Minecraft server as daemon on Amazon Linux
#!/bin/bash
#
# chkconfig: 2345 95 05
#
### BEGIN INIT INFO
# Provides: minecraft-server
# Required-Start: $network $local_fs $remote_fs
# Required-Stop: $network $local_fs $remote_fs
# Should-Start: $syslog
# Should-Stop: $syslog
@pachadotdev
pachadotdev / r_python_homebrew.sh
Last active October 9, 2022 06:41
Install R and Python via Homebrew
# See http://pacha.hk/2017-07-12_r_and_python_via_homebrew.html
# XCode CLT
xcode-select --install
# Update Homebrew and add formulae
brew update
# Check for broken dependencies and/or outdated packages
brew doctor
@mowings
mowings / masq.sh
Last active September 25, 2023 20:00
script to get xet xhyve working with all vpn interfaces
#!/bin/bash
interfaces=( $(netstat -in | egrep 'utun\d .*\d+\.\d+\.\d+\.\d+' | cut -d ' ' -f 1) )
rulefile="rules.tmp"
echo "" > $rulefile
sudo pfctl -a com.apple/tun -F nat
for i in "${interfaces[@]}"
do
RULE="nat on ${i} proto {tcp, udp, icmp} from 192.168.64.0/24 to any -> ${i}"
echo $RULE >> $rulefile
done
@radutzan
radutzan / Transantiago public endpoints.md
Last active October 13, 2023 03:31
APIs REST públicas con data del Transantiago. Respuestas en JSON.

Nuevo: SCLTransit

Ignacio Hermosilla implementó un servicio web de acceso público usando los feeds GTFS de Transantiago y los puntos de acceso oficiales que normalmente requieren acuerdos con el DTPM, para que tú no tengas que hacerlo.

Está toda la información de Transantiago que puedas necesitar, con formatos de alta calidad y sin trámites. Estas APIs son las que ahora alimentan a Cromi.

APIs internas de Transantiago (no recomendadas)

Transantiago implementó estas APIs para uso interno, por lo que no hay ninguna garantía sobre su funcionalidad, mantenimiento o futura existencia. Úsalas bajo tu propio riesgo. (Probablemente no es aconsejable que las uses para nada crítico.)

@hrbrmstr
hrbrmstr / ufos.r
Last active December 4, 2016 02:53
library(tidyverse)
ufos <- read_csv("~/Data/scrubbed.csv")
filter(ufos, country=="us" & (!(state %in% c("ak", "hi", "pr")))) %>%
ggplot(aes(longitude, latitude)) +
geom_jitter(alpha=1/20, size=0.15, color="#ffeda0") +
coord_map("albers", lat0=30, lat1=40) +
ggthemes::theme_map() +
theme(panel.background=element_rect(fill="#2b2b2b"))
@Flower7C3
Flower7C3 / paktpub-claim.js
Last active April 15, 2017 05:16
Claim free book from PaktPub.com - just add min script as bookmark
var PaktPub = (function () {
"use strict";
var freeLearningURL = 'https://www.packtpub.com/packt/offers/free-learning',
logoutURL = 'https://www.packtpub.com/logout';
var notify = function (message, timeout) {
var useNotificationAPI = false;
if ("Notification" in window) {
if (Notification.permission === "granted") {
useNotificationAPI = true;
} else if (Notification.permission !== 'denied') {