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
#!/usr/bin/env bash | |
# Bash function bodies can be delimited by curly braces, | |
# but they don't have to be. The following are all valid | |
# function body delimiters: | |
# | |
# arithmetic: ((expression)) | |
# test: [[ expression ]] | |
# subshell: (list) | |
# group: { list } |
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
#!/usr/bin/env bash | |
# Various methods of using Booleans in Bash | |
# Credit for most of these techniques comes from: | |
# http://stackoverflow.com/questions/2953646/ | |
########################################################### | |
# Using the builtin 'true' and 'false' commands | |
########################################################### |
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
#!/usr/bin/env expect | |
# Automates CVS login to ocr, hwr, and rcr. | |
# Prompts user for password a single time. | |
# Turn off timeout | |
set timeout -1 | |
# Ask user for password | |
stty -echo; # make sure password isn't echo'ed |
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
#!/usr/bin/env bash | |
# There are many ways to get a path to a file or script. | |
# This script showcases several of them and their pitfalls. | |
# Credit for most of these techniques comes from: | |
# http://stackoverflow.com/questions/4774054/ | |
abs_path='/usr/bin/bash' | |
rel_path='.' |
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
SRC := $(wildcard *.dot *.gv) | |
CMD := dot | |
.PHONY: help Makefile | |
# Put it first so that "make" without argument is like "make help". | |
help: | |
@echo Usage: | |
@echo |
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
#!/usr/bin/env bash | |
# Continuously kill processes | |
# Use Ctrl+C to exit | |
while true | |
do | |
read -p "kill " pid | |
if [[ "$pid" == $$ ]] |
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 torch.utils.data import DataLoader | |
from torchgeo.datasets import CDL, Landsat7, Landsat8, stack_samples | |
from torchgeo.samplers import RandomGeoSampler | |
landsat7 = Landsat7(root="...") | |
landsat8 = Landsat8(root="...", bands=Landsat8.all_bands[1:-2]) | |
landsat = landsat7 | landsat8 |
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
cdl = CDL(root="...", download=True, checksum=True) | |
dataset = landsat & cdl |
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
sampler = RandomGeoSampler(dataset, size=256, length=10000) | |
dataloader = DataLoader(dataset, batch_size=128, sampler=sampler, collate_fn=stack_samples) |
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
for batch in dataloader: | |
image = batch["image"] | |
mask = batch["mask"] | |
# train a model, or make predictions using a pre-trained model |
OlderNewer