Skip to content

Instantly share code, notes, and snippets.

View alrocar's full-sized avatar

alrocar alrocar

View GitHub Profile
@alrocar
alrocar / javascript_quickstart
Last active August 12, 2016 12:52
sigte - Summer School 2013 - Javascript lab
//https://developer.mozilla.org/en-US/docs/Web/JavaScript/A_re-introduction_to_JavaScript
//JAVASCRIPT from
0
//to
1 / 0
//this is a single line comment
/*
#!/bin/sh
sudo apt-get update -y
sudo apt-get install git libfreetype6 libpng-dev ntp -y
sudo hostname 'chef.chinatown.com'
echo "chef.chinatown.com" | sudo tee /etc/hostname
sudo echo "127.0.0.1 chef.chinatown.com" >> /etc/hosts
service qpidd stop
@alrocar
alrocar / bash-cheatsheet.sh
Created September 10, 2016 07:16 — forked from LeCoupa/bash-cheatsheet.sh
Bash CheatSheet for UNIX Systems
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
#Add this to your httpd.conf or httpd-vhosts.conf
Header always set Access-Control-Allow-Origin "*"
Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"
Header always set Access-Control-Max-Age "1000"
Header always set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, authorization, accept, client-security-token"
RewriteEngine On
RewriteCond %{REQUEST_METHOD} OPTIONS
RewriteRule ^(.*)$ $1 [R=200,L]
@alrocar
alrocar / LICENSE
Last active April 18, 2017 07:56
carto-tracks-example
Copyright 2017 Alberto Romeu Carrasco
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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
@alrocar
alrocar / README.md
Last active April 20, 2017 10:55
carto-python change privacy of dataset

In order to execute the code snippet below, use the 1.0.0 branch of carto-python. You can follow these steps:

  • git clone https://github.com/CartoDB/carto-python
  • cd carto-python/
  • git checkout 1.0.0
  • virtualenv env
  • source env/bin/activate
  • pip install -r requirements.txt
  • pip install .
  • python change_privacy.py # REMEMBER TO EDIT THE FILE TO INCLUDE YOUR USER CREDENTIALS AND DATASET_NAME
@alrocar
alrocar / join-points
Created April 30, 2017 19:14
Join points with PostGIS
SELECT cartodb_id, ele, time, ST_MAKELINE(the_geom,the_geom2) as the_geom FROM (
SELECT cartodb_id, row_number() OVER w AS ele, time, the_geom, lead(the_geom) OVER w AS the_geom2
FROM TRACK_POINTS WINDOW w AS (PARTITION BY track_fid ORDER BY cartodb_id) ) as q
WHERE the_geom2 IS NOT NULL
@alrocar
alrocar / segment-line
Last active April 30, 2017 19:16
Segment a line with PostGIS
insert into SEGMENTED_DATASET SELECT cartodb_id+n, ST_LineSubstring(the_geom, 100.00*n/length,
CASE
WHEN 100.00*(n+1) < length THEN 100.00*(n+1)/length
ELSE 1
END) As the_geom
FROM
(SELECT TRACK_GPS.cartodb_id,
ST_LineMerge(TRACK_GPS.the_geom) AS the_geom,
ST_Length(TRACK_GPS.the_geom::geography) As length
FROM TRACK_GPS
@alrocar
alrocar / GIF-Screencast-OSX.md
Created June 29, 2017 13:09 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="http://libs.cartocdn.com/cartodb.js/v3/3.15/themes/css/cartodb.css" />
<!-- <link rel="stylesheet" href="https://cartodb-libs.global.ssl.fastly.net/cartodb.js/v3/3.15/themes/css/cartodb.css" /> -->
<style type="text/css">
html,