Skip to content

Instantly share code, notes, and snippets.

View jsta's full-sized avatar
🪼
...

Jemma Stachelek jsta

🪼
...
View GitHub Profile
@vahbuna
vahbuna / pymem.md
Last active August 5, 2025 02:45
Debugging PyTorch memory use with snapshots - Zach's Blog
@benoit-cty
benoit-cty / slack_backup.py
Last active August 25, 2023 16:32
Script to archive Slack messages from a channel list.
'''
Script to archive Slack messages from a channel list.
You have to create a Slack Bot and invite him to private channels.
View https://github.com/docmarionum1/slack-archive-bot for how to configure your account.
Then provide the bot token to this script with the list of channels.
'''
TOKEN='xoxb-xxxxx-xxxxxx-xxxxxxxxxxx'
channels = {
@adamlwgriffiths
adamlwgriffiths / gitea.md
Last active June 27, 2025 07:53
Setup Gitea on Synology DiskStation NAS

Synology Gitea setup

Install Docker

Package Centre > Docker > Install

Create folders

    /docker/gitea/postgresql
 /docker/gitea/gitea
@obrl-soil
obrl-soil / rgrass7-setup-win-osgeo4w.R
Last active March 14, 2024 20:41
rgrass7 and OsGeo4W on Windows - environment variables for R
# Source this file at the top of an R or Rmd file using rgrass7 together
# with GRASS installed via OSGeo4W (https://trac.osgeo.org/osgeo4w/) on a
# Windows machine.
# e.g. source(file.path(getwd(), 'rgrass7-setup-win-osgeo4w.R'))
# You can alternatively add the contents to a project-specific .Rprofile.
# Its better to set these variables in an R session rather than in System,
# especially if you have other GIS software like PostGIS installed, which has
@robbibt
robbibt / geometry_mask_example.py
Last active July 22, 2022 12:39
Rasterio geometry mask example for Stack Exchange
import xarray as xr
import geopandas as gpd
import rasterio
# Open your shapefile and xarray object
ds = raster_mask
gdf = vector_mask
# Select shapefile feature you want to analyse
# and reproject to same CRS as xarray
@mauler
mauler / http_server_auth.py
Last active July 29, 2025 20:28 — forked from fxsjy/SimpleAuthServer.py
Python3 http.server supporting basic HTTP Auth (username/password)
# Extended python -m http.serve with --username and --password parameters for
# basic auth, based on https://gist.github.com/fxsjy/5465353
from functools import partial
from http.server import SimpleHTTPRequestHandler, test
import base64
import os
class AuthHTTPRequestHandler(SimpleHTTPRequestHandler):
@sdondley
sdondley / tmux split-window subcommand.md
Last active August 6, 2025 17:07
Super Guide to the split-window tmux Subcommand (and Beyond)

Super Guide to the split-window tmux Subcommand (and Beyond)

Guide overview

tmux, like other great software, is deceptive. On the one hand, it's fairly easy to get set up and start using right away. On the other hand, it's difficult to take advantage of tmux's adanced features without spending some quality alone time with the manual. But the problem with manuals is that they aren't geared toward beginners. They are geared toward helping seasoned developers and computer enthusiasts quickly obtain the

@tysonwepprich
tysonwepprich / monarch_reanalysis.R
Created March 1, 2019 15:52
Reanalysis of monarch trends reported in Boyle et al. 2019
# Start with all Lepidoptera museum records from
# Boyle, J., H. Dalgleish, and J. Puzey. 2019a.
# Data from: Monarch butterfly and milkweed declines substantially predate
# the use of genetically modified crops. Dryad Digital Repository.
# https://datadryad.org/resource/doi:10.5061/dryad.sk37gd2
# these data were downloaded, cleaned, and saved with code provided in Dryad:
# PART 1.1 Filtering museum data.R
lep <- readRDS("lep_records.rds")
@ScottWales
ScottWales / daily-animation-xarray.py
Last active October 24, 2022 15:49
Animated xarray+cartopy plot
#!/usr/bin/env python
from __future__ import print_function
import xarray
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import matplotlib.animation as anim
import cartopy
filenames = ['/g/data3/w97/dc8106/AMZ_def_EXPs/121GPsc_E0/AMZDEF.daily_tasmax.1978_2011_121GPsc_E0_SAmerica.nc']
@thomasp85
thomasp85 / Denmark_to_Australia.R
Created June 11, 2018 11:23
Preview of view_zoom
library(ggplot2)
library(gganimate)
library(sf)
earth <- sf::st_as_sf(rnaturalearth::countries110)
views <- data.frame(rbind(
st_bbox(earth[earth$name == 'Denmark',]),
st_bbox(earth[earth$name == 'Australia',])
))
p <- ggplot() +
geom_sf(data = earth, fill = 'white') +