Skip to content

Instantly share code, notes, and snippets.

View jsanz's full-sized avatar
🗺️
Mapping

Jorge Sanz jsanz

🗺️
Mapping
View GitHub Profile
@michellemho
michellemho / fake_911_calls.ipynb
Created September 17, 2018 21:48
Generating Emergency Call Data
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

gif-from-tweet

There are so many great GIFs out there and I want to have copies of them. Twitter makes that harder than it should be by converting them to MP4 and not providing access to the source material. To make it easier, I made a bash pipeline that takes a tweet URL and a filename, extracts the MP4 from that tweet and uses ffmpeg to convert back to GIF.

Dependencies

  • ffmpeg
    • macOS: brew install ffmpeg
    • Ubuntu/Debian: apt install ffmpeg
#!/bin/bash
BLIGHT_PATH=$(sudo find /sys -type d -name intel_backlight)
MAX_BRIGHTNESS=$(cat $BLIGHT_PATH/max_brightness)
while [ 1 ]; do
echo "$MAX_BRIGHTNESS*$(fswebcam --png -1 - | convert - -colorspace gray -format "%[fx:mean]" info:)" | \
bc -l | cut -d '.' -f 1 | \
sudo tee $BLIGHT_PATH/brightness;
@nobuti
nobuti / index.html
Created October 19, 2017 10:08
Almost pure React
<html>
<body>
<div id="react-root"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.0.0/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.0.0/umd/react-dom.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.26.0/babel.min.js"></script>
<script id="react-app" type="text/template">
const App = ({name}) => {
@nygeog
nygeog / csv-to-shapefile-geopandas.py
Last active July 18, 2024 00:31
Read a CSV with Pandas and set as GeoDataFrame with geopandas and save as Shapefile with fiona
import pandas as pd
from geopandas import GeoDataFrame
from shapely.geometry import Point
import fiona
df = pd.read_csv('data.csv')
geometry = [Point(xy) for xy in zip(df.x, df.y)]
crs = {'init': 'epsg:2263'} #http://www.spatialreference.org/ref/epsg/2263/
geo_df = GeoDataFrame(df, crs=crs, geometry=geometry)
import urllib,sys,csv;
print reduce(lambda p, new: (p[0] + (new - p[0])/p[1], p[1] + 1), map(float, (x['tip_amount'] for x in csv.DictReader(urllib.urlopen(sys.argv[1])))), (0, 1))
@jorgesancha
jorgesancha / python_code_test_carto.md
Last active March 21, 2024 00:06
Python code test - CARTO
@andy-esch
andy-esch / README.md
Last active December 16, 2016 17:44
TechChange Talk Notes -- Dec 8, 2016

TechChange: Technology for Data Visualization

Basics

  • Use the CARTO Builder for easy visualization of data
    • Put your data on the map
    • Build dashboards to interact with data
    • Dynamically updating maps (sync'd from realtime data)
  • We have free accounts: https://carto.com/signup
@andy-esch
andy-esch / README.md
Last active April 1, 2021 08:45
Explore time and space with SQL and PostGIS
@rochoa
rochoa / app.js
Last active August 2, 2018 11:08
[CARTO] basic viewer
'use strict';
var DEFAULTS = {
endpoint: 'https://rochoa.carto.com',
sql: 'select * from airbnb_madrid_oct_2015_listings',
cartocss: `#layer['mapnik::geometry_type'=1] {
marker-width: 7;
marker-fill: #EE4D5A;
marker-fill-opacity: 0.9;
marker-line-color: #FFFFFF;