Skip to content

Instantly share code, notes, and snippets.

View davidshumway's full-sized avatar

David Shumway davidshumway

  • University of Illinois at Chicago
  • Chicago, IL
View GitHub Profile
@jkatagi
jkatagi / tif_tools.py
Last active April 25, 2023 03:28
Read GeoTiff and convert numpy.array to GeoTiff.
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import os.path
import re
from osgeo import gdal
from osgeo import gdal_array
from osgeo import osr
@agusmakmun
agusmakmun / onlinenowMiddelware.py
Last active December 8, 2022 02:31 — forked from dfalk/onlinenow.py
django online users, usage: {{ request.online_now }} or {{ request.online_now_ids }}, usage: https://python.web.id/blog/django-count-online-users/
from django.conf import settings
from django.core.cache import cache
from django.contrib.auth.models import User
from django.utils.deprecation import MiddlewareMixin
ONLINE_THRESHOLD = getattr(settings, 'ONLINE_THRESHOLD', 60 * 15)
ONLINE_MAX = getattr(settings, 'ONLINE_MAX', 50)
def get_online_now(self):
return User.objects.filter(id__in=self.online_now_ids or [])
@zmbush
zmbush / curl-loop.bash
Created June 14, 2016 21:01
Fetch california election results
while true; do
curl http://api.sos.ca.gov/api/president/party/democratic?format=csv | tail -n +5 > results-$(date +%m-%d_%H%M)
python process.py
sleep 1h
done
@bhousel
bhousel / change_tags.js
Last active August 29, 2015 14:21
Hotkey to change some tags on all selected entities in #iD
context = id;
addTags = { building: 'yes' };
removeTags = ['area','natural','landuse'];
function changeTags() {
var actions = [],
entities = _.filter(_.map(context.selectedIDs(), context.entity),
function(entity) { return entity.geometry(context.graph()) === 'area'; });
_.each(entities, function(entity) {
@pinguet62
pinguet62 / README.md
Last active May 13, 2017 03:22
Build Python script (.py) to Windows executable (.exe).

Python to .exe

This script build a Python script (.py) to Windows executable (.exe).

The output executable can be run:

  • regardless Windows versions,
  • without Python installation,
  • without module installation.

Table of contents

@tonylukasavage
tonylukasavage / script.sh
Created May 29, 2013 18:18
Move all uncommitted changes to a new branch and revert the existing branch to HEAD. "master" has uncommitted changes. You decided you'd rather make those changes in "dev_branch". Here's how to move those uncommitted changes to "dev_branch" and then revert "master" to its last commit.
# get into the master branch
git checkout master
# create a new branch for the changes and check it out
git checkout -b dev_branch
# stash the changes until we revert master
git stash
# go back to master
@KellyRice
KellyRice / iOS Embed Code.html
Last active December 14, 2015 07:29
iOS Embed
<div style="width:600px;background-color:#fff;padding:10px 20px 20px;font:14px/21px HelveticaNeue-Light, Helvetica Neue Light, Helvetica Neue, Helvetica, Arial, sans-serif;">
<h3 style="color:#da5024;clear:both;">See the complete iOS Version History</h3>
<a href="http://www.kinvey.com/blog/2429/ios-version-history-a-visual-timeline"><img alt="Kinvey Backend as a Service" src="http://www.kinvey.com//blog/images/2013/02/ios-version-history-a-visual-timeline.jpg?w=600" width="600" /></a>
<div style="width:100%;text-align:center;margin-top:5px;">From: <a style="text-decoration:none;color:#da5024;" href="http://www.kinvey.com/blog/2429/ios-version-history-a-visual-timeline">Kinvey Backend as a Service</a></div>
</div>
@ruby0x1
ruby0x1 / multi-player-html5-games-00-express.js
Created March 27, 2012 15:01
Multi-player games in HTML5
/* Copyright (c) 2012 Sven "FuzzYspo0N" Bergström
http://underscorediscovery.com
MIT Licensed. See LICENSE for full license.
Usage : node simplest.app.js
*/
var
@spara
spara / create_SF1_tables.sql
Created January 10, 2012 20:25
Create 2010 Census SF1 tables
-- drop table data_field_descriptors;
create table data_field_descriptors
(
sort id integer,
segment varchar(4),
table number varchar(12),
field name varchar(510),
field code varchar(20),
decimal integer
);
@mbrochh
mbrochh / gist:964057
Last active November 10, 2021 19:08
Fast Forward Your Fork
# kudos to https://github.com/drewlesueur
# stolen from here: https://github.com/blog/266-fast-forward-your-fork#comment-11535
git checkout -b upstream-master
git remote add upstream git://github.com/documentcloud/underscore.git
git pull upstream master
git checkout master // [my master branch]
git merge upstream-master
git push origin master