Skip to content

Instantly share code, notes, and snippets.

View mdiener21's full-sized avatar

Michael Diener mdiener21

View GitHub Profile
@mdiener21
mdiener21 / solve_rubics_cube_wired.md
Created October 27, 2022 17:59
Solve Rubiks Cube Wired instructions

Make the daisy Create the white cross Solve the first layer Solve the second layer Create the yellow cross: F U R U' R' F' Solve the yellow face: R U R' U R U2 R' Move yellow stickers upper right-hand corner of left-face Orient "fish" down and to the left relative to your perspective

@mdiener21
mdiener21 / delete_geoserver_layer.py
Created March 19, 2022 14:24
Delete a geoserver layer using the API with Python Requests
import requests
def delete_layer(layer_name):
s = requests.Session()
GEOSERVER_USER = 'someusername'
GEOSERVER_PASS = 'asecretthingy'
s.auth = (GEOSERVER_USER, GEOSERVER_PASS)
headers_json = {'Content-type': 'application/json', }
del_url = "https:/yourgeoserver.com/workspaces/SsmeWorkspaceName/datastores/someDataStoreName/featuretypes/" + layer_name + "?recurse=true"
r = s.delete(del_url, headers=headers_json, data={})
@mdiener21
mdiener21 / generate_git_stats.sh
Last active January 22, 2022 06:31
Git log commands for engineering managers
# git commits per developer
git shortlog -sn --no-merges --since "01 January 2019"
# a clearer better git log view of commits
git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
@mdiener21
mdiener21 / calc_merge_stats.sh
Created January 31, 2021 19:23
print to sdout user git merge info
#!/bin/bash -e
set -o pipefail
# Any arguments are incorrect. Note that git intercepts --help and tries to
# open the man page.
if [ $# -gt 0 ]; then
echo 'Usage: git merge-stats'
exit 1
fi
@mdiener21
mdiener21 / install_docker.yaml
Created January 5, 2021 07:25
Install Docker and Docker-Compose using Ansible
- hosts: all
become: yes
gather_facts: false
tasks:
- name: Install docker packages
remote_user: ubuntu
apt:
name: "{{ item }}"
state: present
update_cache: yes
@mdiener21
mdiener21 / remove_rings.sql
Last active March 1, 2020 15:51
Postgis remove all rings from all polygons
UPDATE multipoly_table_with_rings AS myrings
SET geom = noring.geom
FROM (
SELECT id, ST_Collect(ST_MakePolygon(geom)) AS geom
FROM (
SELECT id, ST_NRings(geom) AS nrings,
ST_ExteriorRing((ST_Dump(geom)).geom) AS geom
FROM multipoly_table_with_rings
WHERE ST_NRings(geom) > 1
) AS foo
@mdiener21
mdiener21 / select_polys_with_points_inside.sql
Last active September 11, 2019 15:07
Select all polygons that contain 1 or more points
SELECT DISTINCT s.id, s.tags
FROM myspace_polys as s
JOIN mypoi_points as as p
ON ST_Contains(s.geom, p.geom);
@mdiener21
mdiener21 / run_postgis_docker.sh
Last active January 2, 2019 07:57
Use docker to create a postgresql and postgis db https://hub.docker.com/r/kartoza/postgis/
$ docker run --name=postgis -d -e POSTGRES_USER=user001 -e POSTGRES_PASS=123456789 -e POSTGRES_DBNAME=gis -p 5432:5432 kartoza/postgis:9.6-2.4
@mdiener21
mdiener21 / install-gdal.sh
Last active December 13, 2018 10:22
Install GDAL Ubuntu 18
sudo apt install python3-gdal gdal-bin
pip install --global-option=build_ext --global-option="-I/usr/include/gdal" GDAL==`gdal-config --version`
@mdiener21
mdiener21 / round_nearest_quarter_hour
Created December 3, 2018 11:14
Formulat for Libre Office Sheets round a duration value to the nearest quarter hour
# sheets formula to round the value in cell F2 to the nearest quarter hour
=HOUR(F2) + (MROUND(MINUTE(F2),15)/60)
if 1:18:33 is the duration the result is 1.25.