Skip to content

Instantly share code, notes, and snippets.

@fgassert
fgassert / descend.py
Last active December 24, 2015 08:09
Descends a directory and executes a command on all files in the directory. Will duplicate directory structure and file names into optional output directory
#!/usr/bin/python
import os
import sys
import subprocess
import string
import fnmatch
def tree(indir, func, pattern, max_level, l=0):
if l>max_level:
@fgassert
fgassert / python_tutorial1.py
Created January 3, 2014 20:09
Intro to Python for GIS tutorial 1: Python basics
'''
Created on Jan 26, 2012
@author: Francis.Gassert
'''
'''
Welcome to Python!
Python is a simple scripting language that allows you to harness the power of your computer.
@fgassert
fgassert / ec2-get-security-credentials
Last active March 18, 2020 01:27
gets iam security credentials from instance metadata and writes them to awscli environment variables and .s3cfg (for s3cmd)
#!/bin/bash
# gets iam security credentials from instance metadata and writes them to
# awscli environment variables and .s3cfg (for s3cmd)
# Usage: ec2-get-security-credentials ROLENAME DEFAULT_REGION
# ROLE=$1
# DEFAULT_REGION=$2
#!/bin/bash -x
S3DIR=s3://fgassert.com/old/
FILENAME=old
PUTDIR=s3://fgassert.com/
sudo apt-get install git -y
git clone https://github.com/s3tools/s3cmd.git
cd s3cmd
#!/bin/bash
echo '[default]' > .s3cfg
if [ -n "$ACCESS_KEY" ] && [ -n "$SECRET_KEY" ] ; then
echo access_key=$ACCESS_KEY >> .s3cfg
echo secret_key=$SECRET_KEY >> .s3cfg
else
echo access_key=$AWS_ACCESS_KEY_ID >> .s3cfg
echo secret_key=$AWS_SECRET_ACCESS_KEY >> .s3cfg
#!/bin/bash -x
curl -O https://gist.github.com/fgassert/8928302/raw/s3cfg_from_env.sh
chmod +x s3cfg_from_env.sh
./s3cfg_from_env.sh
curl -O https://gist.github.com/fgassert/8926988/raw/get_compress_put
chmod +x get_compress_put
./get_compress_put
#!/bin/bash -x
S3DIR=s3://wri-dataupload/isciences/CMIP5/yr/
FILENAME=CMIP5_annual_20140210
PUTDIR=s3://wri-public-data/Aqueduct/
curl -O https://gist.github.com/fgassert/8928302/raw/s3cfg_from_env.sh
chmod +x s3cfg_from_env.sh
./s3cfg_from_env.sh
@fgassert
fgassert / README.md
Last active August 29, 2015 14:00 — forked from mbostock/.block

D3 support for CIE L*a*b* and HCL. These perceptually-motivated color spaces are designed with humans (rather than computers) in mind. RGB and HSL interpolation can cause unintentional grouping due to parts of the color space appearing more visually similar; L*a*b* and HCL, in contrast, are perceptually uniform. For more information, see Gregor Aisch’s post How To Avoid Equidistant HSV Colors and Drew Skau’s post Dear NASA: No More Rainbow Color Scales, Please.

You can create L*a*b* or HCL colors directly using d3.lab or d3.hcl. For example:

var steelblue = d3.lab(52, -4, -32);
var steelblue = d3.hcl(-97, 32, 52);

You can also convert from RGB or HSL. This is useful for creating brighter or darker colors with uniform changes in perception:

<!DOCTYPE html>
<html>
<head>
<title>Vertical - Build Up</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge;chrome=1" >
<!-- bootstrap magic -->
<link rel="stylesheet" type="text/css" href="assets/css/bootstrap.min.css">
### Keybase proof
I hereby claim:
* I am fgassert on github.
* I am fgassert (https://keybase.io/fgassert) on keybase.
* I have a public key whose fingerprint is 2AE9 E00A F496 7931 F370 D801 4266 81E3 81A2 AFCD
To claim this, I am signing this object: