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
@mowings
mowings / masq.sh
Last active August 18, 2025 05:01
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 April 14, 2026 18:28
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') {
@asadharis
asadharis / README.md
Last active November 16, 2023 08:40 — forked from dan-blanchard/create_single_machine_sge.md
How to setup a single-machine (Sun) Grid Engine installation for unit tests on Travis-CI

Setting up a SGE cluster on a single Amazon EC2 machine

The gist here provides a script to automate the process of installing Sun Grid Engine (SGE) on a single EC2 machine.

Motivation

SGE is a job scheduler for a computing cluster. This usually involves a cluster of multiple machines. However for many applications we don't need a massive computing cluster and a cluster of 8-30 nodes would be sufficient. In this tutorial we set-up SGE on a single amazon EC2 machine. The reasons for doing so are as follows:

  1. Automation: Setting-up a cluster with SGE is fairly involved as it requires multiple machines communicating with each other and having some shared memory. A single machine with multiple cores is already a simple cluster where the memory is shared across cores.
  2. Moderate Size: Amazon EC2 instances provide a variety of computing options with the number of cores ranging from 1 to 128.
  3. Cost: The On-Demand price structure of AWS makes this a relatively cheap option. Further cost redu