Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import psycopg2 | |
database = '' | |
host = 'localhost' | |
port = 5432 | |
user = '' | |
password = '' | |
table = '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PyQt4.QtCore import * | |
from PyQt4.QtGui import * | |
from qgis.core import * | |
coverage = "/Users/joellawhead/qgis_data/atlas/grid.shp" | |
atlasPattern = "/Users/joellawhead/qgis_data/atlas/output_" | |
# Load the map layer. This example uses a shapefile | |
# but you can use any supported QGIS layer. | |
vlyr = QgsVectorLayer(coverage, "grid", "ogr") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Likely not useful to anyone else, but just putting it out there. | |
This script will take a directory of GeoTIFFs and merge them together without issues. | |
This script simply decompresses the files, runs nearblack to remove pseudo-black borders caused by compression, and then uses gdalwarp to stitch the files together. | |
The script is designed to use the minimal amount of disk space possible -- it cleans up each file after decompression and continually merges with a master image. | |
""" | |
import os |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import re | |
regexp = re.compile(r'\.jpg') | |
folder = os.path.expanduser('~/Desktop/photos') | |
for filename in os.listdir(folder): | |
infilename = os.path.join(folder, filename) | |
if regexp.search(filename): | |
oldbase = os.path.splitext(filename) | |
newname = infilename.replace('.jpg', '.jpeg') | |
output = os.rename(infilename, newname) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If you come from bash you might have to change your $PATH. | |
# export PATH=$HOME/bin:/usr/local/bin:$PATH | |
# Path to your oh-my-zsh installation. | |
export ZSH=/Users/brianbancroft/.oh-my-zsh | |
# Set name of the theme to load. Optionally, if you set this to "random" | |
# it'll load a random theme each time that oh-my-zsh is loaded. | |
ZSH_THEME="powerlevel9k/powerlevel9k" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# ---------------------- | |
# KUDU Deployment Script | |
# Version: 1.0.15 | |
# ---------------------- | |
# Helpers | |
# ------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[user] | |
name = Brian | |
email = hello@brianbancroft.ca | |
name = Brian | |
name = Brian | |
name = --repace-all | |
name = Brian Bancroft | |
[push] | |
default = upstream | |
[branch] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT( | |
SELECT COUNT(*) | |
FROM regs | |
WHERE invite_sent_at <= NOW() - INTERVAL '10 days' | |
) AS count_users, | |
( | |
SELECT COUNT(*) | |
FROM regs | |
WHERE invite_sent_at <= NOW() - INTERVAL '30 days' | |
) AS count_users, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def warn(message) | |
puts "\e[#{31}m#{message}\e[0m" | |
end |