Skip to content

Instantly share code, notes, and snippets.

@cuppster
cuppster / README.md
Created Sep 12, 2020 — forked from klokan/README.md
NASA Blue Marble
View README.md

NASA Blue Marble

Prepared for MapTiler: http://www.maptiler.com/ or other GDAL tools

GDAL vrt

Download the high-resolution images from http://visibleearth.nasa.gov/view.php?id=73751

wget http://eoimages.gsfc.nasa.gov/images/imagerecords/73000/73751/world.topo.bathy.200407.3x21600x21600.A1.jpg
wget http://eoimages.gsfc.nasa.gov/images/imagerecords/73000/73751/world.topo.bathy.200407.3x21600x21600.A2.jpg
@cuppster
cuppster / README.md
Created Sep 12, 2020 — forked from klokan/README.md
NASA Blue Marble
View README.md

NASA Blue Marble

Prepared for MapTiler: http://www.maptiler.com/ or other GDAL tools

GDAL vrt

Download the high-resolution images from http://visibleearth.nasa.gov/view.php?id=73751

wget http://eoimages.gsfc.nasa.gov/images/imagerecords/73000/73751/world.topo.bathy.200407.3x21600x21600.A1.jpg
wget http://eoimages.gsfc.nasa.gov/images/imagerecords/73000/73751/world.topo.bathy.200407.3x21600x21600.A2.jpg
View dms2dec.py
#!/env/python
# coding=utf8
"""
Converting Degrees, Minutes, Seconds formatted coordinate strings to decimal.
Formula:
DEC = (DEG + (MIN * 1/60) + (SEC * 1/60 * 1/60))
Assumes S/W are negative.
@cuppster
cuppster / ShortGUID.cs
Last active Aug 29, 2015
Create short GUIDs with a custom alphabet
View ShortGUID.cs
using System;
using System.Numerics;
namespace Cuppster
{
/// <summary>
/// converted from the python version at https://github.com/stochastic-technologies/shortuuid
/// </summary>
class ShortUUID
{
View designer.html
<link rel="import" href="../components/polymer/polymer.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
@cuppster
cuppster / Adorners.cs
Last active Aug 29, 2015
Technique using a binding converter to return an object representing viewmodel state for displaying an adorner.
View Adorners.cs
using System;
using System.Globalization;
using System.Windows.Data;
namespace WpfApplication1
{
/*
see: http://cuppster.com/2014/07/10/using-the-state-pattern-for-adorning-in-xaml/
View DocModule.cs
using Nancy;
namespace MyApi
{
public class DocModule : NancyModule
{
public DocModule()
{
Get ["/doc"] = _ => {
return View ["index.html"];
@cuppster
cuppster / flask_gridfs_images.py
Created Mar 12, 2013
Recipe for downloading images into a mongoDB gridfs collection, then serving the images with a Flask application. No temp files created.
View flask_gridfs_images.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
SYNOPSIS
flask_gridfs_images.py --start
flask_gridfs_images.py --add <IMAGE_URL>
DESCRIPTION
@cuppster
cuppster / template.js
Last active Dec 14, 2015
Template backbone.js code that encapsulates a datatable.net table within a view for a hypothetical auction listings application.
View template.js
/*
* Template backbone.js code that encapsulates a
* datatable.net table within a view for a hypothetical ;)
* auction listings application.
*/
var HomeRouter = Backbone.Router.extend({
routes: {
'refresh' : 'refresh',
@cuppster
cuppster / getcomics.py
Created Jan 30, 2013
Mini-framework for scraping web pages with python using PyQuery, decorators and generators.
View getcomics.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys, re
import itertools
from functools import wraps
from pyquery import PyQuery as pq
class scrape: