Skip to content

Instantly share code, notes, and snippets.


Camilo Sampedro camilosampedro

View GitHub Profile
robmathers / groupBy.js
Created Oct 25, 2018
A more readable and annotated version of the Javascript groupBy from Ceasar Bautista (
View groupBy.js
var groupBy = function(data, key) { // `data` is an array of objects, `key` is the key (or property accessor) to group by
// reduce runs this anonymous function on each element of `data` (the `item` parameter,
// returning the `storage` parameter at the end
return data.reduce(function(storage, item) {
// get the first instance of the key by which we're grouping
var group = item[key];
// set `storage` for this instance of group to the outer scope (if not empty) or initialize it
storage[group] = storage[group] || [];
View .vimrc
set nocompatible
filetype off
syntax on
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'nvie/vim-flake8'
sinmetal / export.go
Created Nov 27, 2017
Google Cloud Datastore Export Handler
View export.go
package datastorebackup
import (
ahmetb /
Last active Nov 23, 2020
Script to clean up Google Container Registry images pushed before a particular date
# Copyright © 2017 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# Unless required by applicable law or agreed to in writing, software
camilosampedro / Install Aton
Last active Nov 7, 2016
Installs Java 8, Activator and MySQL on Ubuntu 16.04 LTS
View Install Aton
# Variables
# Install java
echo " => Installing Java 8"
echo " ==> Adding webupd8team/java repository"
sudo add-apt-repository ppa:webupd8team/java
echo " ==> Updating with the added repository"
View javascript-trim-svg-whitespace.js
function trimSvgWhitespace() {
// get all SVG objects in the DOM
var svgs = document.getElementsByTagName("svg");
// go through each one and add a viewbox that ensures all children are visible
for (var i=0, l=svgs.length; i<l; i++) {
var svg = svgs[i],
box = svg.getBBox(), // <- get the visual boundary required to view all children
cpburnz / NVIDIA_GeForce_GTX_960M_with_Optimus_on_Arch_Linux.rst
Last active Jan 31, 2020
NVIDIA GeForce GTX 960M with Optimus on Arch Linux
View NVIDIA_GeForce_GTX_960M_with_Optimus_on_Arch_Linux.rst


  • bumblebee 3.2.1-10 (provides nvidia-libgl)
  • mesa 11.0.4-1
  • mesa-libgl 11.0.4-1
  • nvidia 355.11-4 (Nvidia driver)
  • primus 20150118-2 (Bumblebee bridge)
  • xf86-video-intel 1:2.99.917+478+gdf72bc5-2 (Intel driver)
granturing / reactive_map.js
Last active Sep 20, 2019
Sample reactive Leaflet code for Zeppelin
View reactive_map.js
<!-- place this in an %angular paragraph -->
<link rel="stylesheet" href="" />
<div id="map" style="height: 800px; width: 100%"></div>
<script type="text/javascript">
function initMap() {
var map ='map').setView([30.00, -30.00], 3);
L.tileLayer('http://{s}{z}/{x}/{y}.png', {
rjz / handler.go
Last active Oct 1, 2019
Handle Github webhooks with golang
View handler.go
// Now available in package form at
package handler
import (
View message with
sudo -u $USERNAME DISPLAY=:0.0 zenity --warning --text="$MESSAGE"
You can’t perform that action at this time.