Skip to content

Instantly share code, notes, and snippets.

View wylee's full-sized avatar

Wyatt wylee

View GitHub Profile
@wylee
wylee / gist:3783735
Created September 25, 2012 18:55
My first Go program
/*
This "script" scrapes a collection of images from Wikipedia.
It reads a file containing a list of URLs (that were previously scraped
from the index page of the collection). For each of those URLs, it
retrieves the pointed-to page, locates a particular image URL within that
page (using a regex), and then downloads the image.
The image is written in 1MB chunks; progress is reported as each chunk is
written. Downloaded images are named N.jpg where N corresponds to the line
@wylee
wylee / gist:4559038
Created January 17, 2013 19:46
Accessing INI configuration from within Pyramid
# development.ini
[server:main]
use = egg:waitress
[app:main]
use = call:myproject:main
[app:mysettings]
use = call:myproject:noop
a = 1
@wylee
wylee / pgcopy.sh
Last active February 6, 2024 20:28
Bash script to copy a Postgres database from one host/instance to another
#!/bin/bash
#
# NOTE: Although this script attempts to be safe, it has the potential
# to be highly destructive; please run with caution.
#
# This copies the specified database from pgsql.rc.pdx.edu to
# postgresql.rc.pdx.edu.
#
# If the database is PostGIS-enabled, use the --postgis flag. This also
# requires that postgis_restore.pl is on your $PATH.
import fnmatch
import mimetypes
import os
from django.conf import settings
from django.core.management.base import BaseCommand
from arcutils.colorize import printer
import collections
import itertools
import sys
import timeit
import unittest
from typing import Callable, Iterable, Tuple
def oddity(iterable: Iterable,