Skip to content

Instantly share code, notes, and snippets.

commit = "Z"
with lcd("%s" % (project)):
commit = local("git log -g --pretty=%B -n 1")
print commit
print "@@"
print commit
print "$$"
# Output:
# Move into home directory
cd ~/
# Add QGIS repo
sudo add-apt-repository -s "deb http://qgis.org/debian trusty main"
# Add TileMill repo
sudo add-apt-repository ppa:developmentseed/mapbox
# Update/upgrade
var express = require('express');
var app = express();
var fs = require('fs');
app.use(function(req, res, next) {
if (req.url.match(/^\/?[^/]+\/?$/)) {
if (req.url.match(/[.][0-9a-z]+$/i)) {
next();
var t = {"1001":0.0001,"1003":0.0003,"1005":0.0004,"1007":0.0004,"1009":0.0001,"1013":0.0007,"1015":0.0015,"1017":0.0004,"1019":0.0009,"1021":0.0009,"1023":0.0007,"1025":0.0001,"1029":0.0009,"1031":0.0003,"1033":0.001,"1035":0.0002,"1039":0.0001,"1041":0.0001,"1043":0.0003,"1045":0.0002,"1047":0.0017,"1049":0,"1051":0.0002,"1053":0.0003,"1055":0.0005,"1057":0.0001,"1059":0.0001,"1061":0.0001,"1067":0.0002,"1069":0.0005,"1071":0.0002,"1073":0.0001,"1077":0,"1079":0.0002,"1081":0.0002,"1083":0.0002,"1085":0.0001,"1089":0.0002,"1091":0.0001,"1093":0.0001,"1095":0.0003,"1097":0.0013,"1101":0.0012,"1103":0.0001,"1107":0,"1109":0,"1111":0,"1113":0.0003,"1115":0.0004,"1117":0.0001,"1121":0.0003,"1123":0.0003,"1125":0.0006,"1127":0,"1129":0.0023,"1133":0.0002,"2020":0.0004,"2090":0.0001,"2110":0.0004,"2130":0.0003,"2150":0.0004,"2170":0,"4001":0.0001,"4003":0.0004,"4005":0.0005,"4007":0.0018,"4009":0.0001,"4011":0.0013,"4012":0.0022,"4013":0.0001,"4015":0.0001,"4017":0.0002,"4019":0.0002,"4021":0.0002,"4023":0.0002,"
cd TimelineJS/source/js/Core/Language/locale
# Append fs.writeFile("[abbreviation].json",JSON.stringify(VMM.Language)) to each file
for f in *; do echo "fs.writeFile(\"$f\".replace(\".js\",\".json\"),JSON.stringify(VMM.Language));" >> $f; done
# Initialize required vars in an alphabetically first file
echo "var fs = require('fs'), trace = function(){}, VMM = {};" > aa.js
# Combine to one script
cat * > execute-me.js
@veltman
veltman / gist:46cb820a4cc75d6e0aab
Last active August 29, 2015 14:06
Create a CSV of properties + bbox using ogr2ogr
ogr2ogr -f "GeoJSON" -lco WRITE_BBOX=true /dev/stdout us-states.geojson | jq --raw-output '[.features[] | ((.properties | to_entries | [.[] | .value] ) + [.bbox[]] | @csv)] | .[]' > results.csv
var numBouncy = 0,
exp = 100;
//Row number (r) in Pascal's triangle is how many digits long a number is
//The position (p) in the row, from the left, is the number of unique digits in the number
//The value (v) in position (r,p) is how many different arrangements of p digits are possible in an r-digit number
//For 1 to 100 digits long
for (var r = 1; r <= exp; r++) {
#!/bin/bash
# Move into home directory
cd ~/
# Add QGIS repo
sudo add-apt-repository -s "deb http://qgis.org/debian trusty main"
# Add TileMill repo
sudo add-apt-repository ppa:developmentseed/mapbox
var proj4 = require("proj4");
var nypdProj = 'PROJCS["NAD_1983_StatePlane_New_York_Long_Island_FIPS_3104_Feet",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",984250.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-74.0],PARAMETER["Standard_Parallel_1",40.66666666666666],PARAMETER["Standard_Parallel_2",41.03333333333333],PARAMETER["Latitude_Of_Origin",40.16666666666666],UNIT["Foot_US",0.3048006096012192]]';
var x = 981349,
y = 198508;
var lngLat = proj4(nypdProj).inverse([x,y]);
//[ -74.01046412781942, 40.71153483835092 ]
var fs = require("fs"),
csv = require("csv-parser"),
stringify = require("csv-stringify"),
proj4 = require("proj4");
var nypdProj = 'PROJCS["NAD_1983_StatePlane_New_York_Long_Island_FIPS_3104_Feet",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",984250.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-74.0],PARAMETER["Standard_Parallel_1",40.66666666666666],PARAMETER["Standard_Parallel_2",41.03333333333333],PARAMETER["Latitude_Of_Origin",40.16666666666666],UNIT["Foot_US",0.3048006096012192]]';
var stateplane = proj4(nypdProj);
fs.createReadStream("2013.csv")