Skip to content

Instantly share code, notes, and snippets.

@nikmolnar
nikmolnar / pyproject.toml
Created March 31, 2021 00:56
Example poetry error
[tool.poetry]
name = "poetry-bug"
version = "0.1.0"
description = ""
authors = ["Me"]
[tool.poetry.dependencies]
python = "^2.7"
[tool.poetry.dev-dependencies]
for file in tpk/*.tpk; do \
fileout="${file##*/}" && \
tpk export mbtiles --overwrite --drop-empty -tb "$file" "mbtiles/${fileout%%.*}.mbtiles" \
; done
@nikmolnar
nikmolnar / daylight.py
Created August 30, 2017 23:24
Daylight Algorithm
def get_julian_day(date):
a = (14 - date.month) // 12
y = date.year + 4800 - a
m = date.month + 12 * a - 3
julian_date = date.day + (153 * m + 2) // 5 + 365 * y + y // 4 - y // 100 + y // 400 - 32045
return julian_date - 2451545 + .0008
def daylight(date, lat, lon):
""" Returns daylight hours for a single lat/lon point """
@nikmolnar
nikmolnar / resync.js
Created July 18, 2016 22:44
Experimenting with redux + async ideas...
import fetch from 'isomorphic-fetch'
import { getCookies } from './utils'
import uuid from 'node-uuid'
import { store } from '.'
class Request {
constructor() {
this.promiseUUID = null
}
import os
from pyproj import Proj
DEM = 'aligned_elevation.nc'
DATA_DIR = 'west1/1961_1990Y/'
ZONES_DIR = 'seed_zones/'
OUTPUT_DIR = 'output/'
CRS = {'init': 'EPSG:4326'}
import errno
import math
import os
import time
from csv import DictWriter
from netCDF4 import Dataset
import fiona
import numpy
from clover.geometry.bbox import BBox
@nikmolnar
nikmolnar / tif_to_nc.sh
Created June 4, 2016 00:43
Bash script to convert all GeoTIFF files in a directory to NetCDF
#!/bin/bash
for filename in ./*.tif; do
if [[ $filename =~ Y_([a-zA-Z0-9_]+)\.tif$ ]]
then
variable="${BASH_REMATCH[1]}"
clover to_netcdf $filename netcdf/$variable.nc $variable
fi
done
@nikmolnar
nikmolnar / settings_1_9.py
Created March 24, 2016 01:37
Django 1.9 Settings
"""
Django settings for foo project.
Generated by 'django-admin startproject' using Django 1.9.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
@nikmolnar
nikmolnar / settings_1_8.py
Created March 24, 2016 01:35
Django 1.8 Settings
"""
Django settings for untitled1 project.
Generated by 'django-admin startproject' using Django 1.8.10.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/

Keybase proof

I hereby claim:

  • I am nikmolnar on github.
  • I am nikmolnar (https://keybase.io/nikmolnar) on keybase.
  • I have a public key whose fingerprint is 183C 6E34 83E2 035C 2BE3 9A75 F3D6 201C 27A6 6A6C

To claim this, I am signing this object: