Skip to content

Instantly share code, notes, and snippets.

View jsanz's full-sized avatar
🗺️
Mapping

Jorge Sanz jsanz

🗺️
Mapping
View GitHub Profile
#!/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 November 25, 2023 09:47
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
@imincik
imincik / screens.sh
Created August 27, 2016 18:23
Screens switching script
#!/bin/bash
# Author: Ivan Mincik, ivan.mincik@gmail.com
S_PRIMARY="eDP1"
S_OTHER=$(xrandr \
| grep -v "^$S_PRIMARY" \
| grep " connected" \
| awk -F " " '{print $1}')
@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;
@javisantana
javisantana / gmaps.js
Created April 25, 2016 06:50
first version of google maps source code (from archive.org)
/*
FILE ARCHIVED ON 3:09:27 feb 10, 2005 AND RETRIEVED FROM THE
INTERNET ARCHIVE ON 19:57:07 abr 24, 2016.
JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE.
ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C.
SECTION 108(a)(3)).
*/
// Copyright 2005 Google
function ci(vg, Pf, yh) {