Skip to content

Instantly share code, notes, and snippets.

@geozelot
geozelot / ST_PointBufferWedge.sql
Last active January 7, 2022 20:08
PostgreSQL/PostGIS - Create a wedge of a buffer around a point, with optional inner radius
/*
* @params
* pnt - center POINT geometry
* sdeg - wedge sector start value; in degrees
* edeg - wedge sector end value; in degrees
* irad - radius around @pnt for the inner extend of the wedge; in meter
* orad - radius around @pnt for the outer extend of the wedge; in meter
* qsegs - vertices per full quarter circle; at least two vertices will be created
*
* The function will calculate the angular difference in clockwise direction, from @sdeg to @edeg.
@joseluisq
joseluisq / stash_dropped.md
Last active October 3, 2025 09:40
How to recover a dropped stash in Git?

How to recover a dropped stash in Git?

1. Find the stash commits

git log --graph --oneline --decorate ( git fsck --no-reflog | awk '/dangling commit/ {print $3}' )

This will show you all the commits at the tips of your commit graph which are no longer referenced from any branch or tag – every lost commit, including every stash commit you’ve ever created, will be somewhere in that graph.

@cdleon
cdleon / macbook-pro-2011-defective-gpu-fix.md
Last active July 22, 2025 01:39
Macbook Pro 2011 GPU Defect fix macOS Sierra and High Sierra
@blackgate
blackgate / mbp2011-disable-amd-gpu.md
Last active June 11, 2025 10:32
Macbook Pro 2011 - Disable AMD GPU
@wojteklu
wojteklu / clean_code.md
Last active October 29, 2025 16:14
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@ianturton
ianturton / CellTower.java
Last active October 27, 2021 11:23
GeoTools program to calculate a wedge shaped polygon 10 degrees wide given a lat,lon radius and azimuth.
package spike;
import java.awt.geom.Point2D;
import java.util.ArrayList;
import org.geotools.referencing.GeodeticCalculator;
import org.geotools.referencing.crs.DefaultGeographicCRS;
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.GeometryFactory;
@clhenrick
clhenrick / README.md
Last active March 3, 2025 23:02
PostgreSQL & PostGIS cheatsheet (a work in progress)
@ms-tg
ms-tg / jdk8_optional_monad_laws.java
Created November 11, 2013 21:14
Does JDK8's Optional class satisfy the Monad laws? Yes, it does.
/**
* ```
* Does JDK8's Optional class satisfy the Monad laws?
* =================================================
* 1. Left identity: true
* 2. Right identity: true
* 3. Associativity: true
*
* Yes, it does.
* ```