Skip to content

Instantly share code, notes, and snippets.

@adammiller
adammiller / douglasPeucker.js
Created February 14, 2011 16:54
Javascript implementation of the Douglas Peucker path simplification algorithm
var simplifyPath = function( points, tolerance ) {
// helper classes
var Vector = function( x, y ) {
this.x = x;
this.y = y;
};
var Line = function( p1, p2 ) {
this.p1 = p1;
@PhilippSalvisberg
PhilippSalvisberg / wrap_schema.sql
Last active July 16, 2020 22:08
Wrap PL/SQL code in the current user of an Oracle database 10g or higher
/*
* Copyright 2016 Philipp Salvisberg <[email protected]>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@heiswayi
heiswayi / repo-reset.md
Created February 5, 2017 01:32
GitHub - Delete commits history with git commands

First Method

Deleting the .git folder may cause problems in our git repository. If we want to delete all of our commits history, but keep the code in its current state, try this:

# Check out to a temporary branch:
git checkout --orphan TEMP_BRANCH

# Add all the files:
git add -A
@SirWellington
SirWellington / WorstFunctionEver.java
Created April 1, 2019 00:24
This is the worst function I have ever read, courtesy of Android's FragmentManagerImpl class
void moveToState(Fragment f, int newState, int transit, int transitionStyle,
boolean keepActive) {
// Fragments that are not currently added will sit in the onCreate() state.
if ((!f.mAdded || f.mDetached) && newState > Fragment.CREATED) {
newState = Fragment.CREATED;
}
if (f.mRemoving && newState > f.mState) {
if (f.mState == Fragment.INITIALIZING && f.isInBackStack()) {
// Allow the fragment to be created so that it can be saved later.
newState = Fragment.CREATED;
@pb111
pb111 / XGBoost with Python and Scikit-Learn.ipynb
Created July 8, 2019 07:03
XGBoost with Python and Scikit-Learn
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@johnwbryant
johnwbryant / extract_aus.sh
Last active September 17, 2024 01:18
Extract Australia data in a usable format from Microsoft road detections data
#!/bin/bash
# see https://github.com/microsoft/RoadDetections
# 1) get the data
wget https://usaminedroads.blob.core.windows.net/road-detections/Oceania-Full.zip
# 2) extract the records for Australia, second column of tsv only
zgrep AUS Oceania-Full.zip | cut -f2 > AUS.geojson
# 3) convert to GPKG, works better in QGIS