Skip to content

Instantly share code, notes, and snippets.

@glw
glw / search.sh
Created October 24, 2017 16:04
Search for each TIF and return wether it is valid or not
echo "file, output" > output.csv;
TIFS=$(find . -name '*.TIF');
for f in $TIFS; do
output=$(tiffinfo.exe $f 2>&1 | grep 'Cannot read TIFF header');
echo "$f, $output" >> output.csv;
done
@glw
glw / tmux-cheatsheet.markdown
Last active March 29, 2018 21:57 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@glw
glw / gist:f5d7096c30184163a425b1cb0015f6fe
Created June 2, 2017 21:19
use jupyter notebook in any virtualenv
workon web-app
pip install ipykernel
python -m ipykernel install --user --name web-app --display-name "Webapp"
#then start jupyter, and you should see "Webapp" in the drop down for kernels
@glw
glw / postgres-postgis-cheat-sheet.md
Last active February 20, 2019 22:36
postgis cheat sheet
@glw
glw / scheduleTask
Created February 25, 2016 22:56
schedule task via command line in Windows
#/create = create new task
#/tn = task name
#/sc = frequency
#/tr = command to start task
#more info https://technet.microsoft.com/en-us/library/cc772785%28WS.10%29.aspx#BKMK_create
schtasks /create /tn "createKML" /sc MONTHLY /tr "python c:\path\to\file.py"
@glw
glw / scp-rsync
Last active June 17, 2016 22:44
use SCP or RSYNC to copy files from one computer to another
#for scp or rsync src and dest patterns are the same
scp /source/path/to/files [email protected]:/destination/pathh/to/files
#on Windows scp will work with Cygwin
##From local Windows machine to remote server. CD your way to the directory holding your file(s)
scp files.zip [email protected]:/home/projects
##From remote server to your local Windows machine. CD your way to the directory where you want to save your file
scp [email protected]:/home/projects/your_file.csv ./
@glw
glw / environment
Created August 10, 2015 03:57
altered enviroment file to enable out of db and gdal drivers for postgis 2.1.x and below
# environment variables for postmaster process
# This file has the same syntax as postgresql.conf:
# VARIABLE = simple_value
# VARIABLE2 = 'any value!'
# I. e. you need to enclose any value which does not only consist of letters,
# numbers, and '-', '_', '.' in single quotes. Shell commands are not
# evaluated.
#====================================================
#Enable out of db rasters and gdal drivers
@glw
glw / index.html
Last active August 29, 2015 14:26
Cross Domain GeoJSON w/ Omnivore and MapBoxJS
<!DOCTYPE html>
<meta charset="utf-8">
<html>
<head>
<script src='https://api.mapbox.com/mapbox.js/v2.2.1/mapbox.js'></script>
<link href='https://api.mapbox.com/mapbox.js/v2.2.1/mapbox.css' rel='stylesheet' />
</head>
@glw
glw / map_drives
Created July 7, 2015 17:33
batch map network drives for Windows (dos)
:: repeat for all folders needed
:: replace anything between < > , as well as drive letter.
net use U: \\xx.xxx.xxx.xxx\folder <password> /user:<domain>\<username> /persistent:yes
@glw
glw / geocoder
Last active October 21, 2015 22:19
python geocoder example
sudo pip install geocode
sudo apt-get install jq
sudo apt-get update
#from command line
#geocoder does not have to be google
#to save as json
geocode -p "google" addresses.txt | jq -r -c '@json' >> results3.json
#to save as csv