Skip to content

Instantly share code, notes, and snippets.

maphew / PS-BGInfo.ps1
Created Apr 27, 2022 — forked from dieseltravis/PS-BGInfo.ps1
update wallpaper background image with powershell (like Sysinternals BGInfo)
View PS-BGInfo.ps1
# PS-BGInfo
# Powershell script that updates the background image with a random image from a folder and writes out system info text to it.
# run as a lower priority task
[System.Threading.Thread]::CurrentThread.Priority = 'BelowNormal'
# Configuration:
# Font Family name
maphew / console-log.txt
Created Apr 13, 2022
troubles installing rustc (gcc, libc-dev) on Ubuntu 20.4
View console-log.txt
# part of
(rio-viz) geoadmin@geonix:~$ sudo mv /var/lib/apt/lists/* apt-temp/
[sudo] password for geoadmin:
(rio-viz) geoadmin@geonix:~$ ls /var/lib/apt/lists
(rio-viz) geoadmin@geonix:~$ sudo apt update
Get:1 focal InRelease [265 kB]
Get:2 focal InRelease [57.7 kB]
Get:3 focal InRelease [265 kB]
maphew / conda-downgrade-report.txt
Created Jan 25, 2022
example of `conda install pkg=old.ver.num` downgrading existing packages
View conda-downgrade-report.txt
# a console output snippet that shows conda does downgrade to older version of currently installed package
$ conda install gdal=3.4.0
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: done
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
maphew /
Created Jan 10, 2022
Copy RPC metdata from IN raster to OUT raster
'''Copy RPC metdata from IN raster to OUT raster
Adapted from @user7821537
import os
import sys
from osgeo import gdal
maphew / clean.ps1
Last active Jan 6, 2022
Recipe for setting up environment for geospatial processing on Windows [DRAFT]
View clean.ps1
scoop uninstall scoop
$xlist = "$env:userprofile\scoop", "c:\apps\geo", "$env:userprofile\.condarc", "$env:userprofile\.conda", "$env:userprofile\.config\scoop"
foreach ($x in $xlist) {
if (Test-Path $x) { Remove-Item $x}
maphew / setenv-testing-result.txt
Created Dec 7, 2021
Detect if bat file is running via double click or from cmd window
View setenv-testing-result.txt
T:\ENV.558>if /I "C:\WINDOWS\system32\cmd.exe /c ``T:\ENV.558\setenv-testing.bat` `" EQU "`C:\WINDOWS\system32\cmd.exe` /C ``T:\ENV.558\setenv-testing.bat` `" pause
maphew /
Created Sep 14, 2021
Generate a blog-style index page written in markdown
"""Generate a blog-style index page written in markdown.
A header line with link to page, followed by a few lines of the story.
import os
from pathlib import Path
import dateutil.parser
from inspect import getsourcefile
here = os.path.dirname(os.path.abspath(getsourcefile(lambda:0)))
View gist:513404f56b956ef3f1379b70d1d5d87f
Files: DIM_SPOT6_MS_201308032015087_SEN_1.XML
maphew /
Created Jun 24, 2021
Compress to Cloud Geotiff stub in ArcGIS Pro python toolbox (rename to *.pyt to get Pro to recognize it)
# -*- coding: utf-8 -*-
import arcpy
from osgeo import gdal
class Toolbox(object):
def __init__(self):
"""Define the toolbox (the name of the toolbox is the name of the
.pyt file)."""
self.label = "Toolbox"
maphew /
Created Feb 1, 2021
Figuring out how to generate an H3 hex grid from a given poly layer, in Qgis python processing environment.
# adapted from
import os
from qgis.utils import iface
from qgis.core import (
QgsFeature, QgsField, QgsFields,
QgsGeometry, QgsPointXY, QgsProject,
QgsProcessingFeedback, QgsMessageLog,