Skip to content

Instantly share code, notes, and snippets.

View alexbodn's full-sized avatar

Alex Bodnaru alexbodn

View GitHub Profile
@alexbodn
alexbodn / dataextent.js
Created March 18, 2024 14:15
calculate the extent of a geoJSON geometry
/**
* @data : Object object parsed from a geoJSON file.
* @options: used internally as this function calls itself recursively.
**/
const dataExtent = (data, {depth=0, inCoordinates=false, extent}={}) => {
if (!extent) {
extent = [[Infinity, Infinity], [-Infinity, -Infinity]];
}
if (Array.isArray(data)) {
@alexbodn
alexbodn / peakdet.py
Created October 28, 2022 05:48
find a list of peaks and valleys in xy points sequence
import numbers
import math
from collections.abc import Iterable
def peakdet(v, delta, x=None, xinit=1, original=False):
"""
this code was kindly provided by it's original developer.
# Eli Billauer, 3.4.05 (Explicitly not copyrighted).
#!/bin/sh
#first install linux (i like debian) and ensure you have 3
#bootable partitions, with the disk partitioned as mbr.
#ext4 partition holding debian, with about 20GB free for downloads.
#ntfs with at least 32GB to install windows in.
#ntfs of about 32GB for preparing a bootable rescue disk.
#the default partitioning mode is gpr, with one linux partition that
#takes the whole disk. you may repartition the disk while booting a
@alexbodn
alexbodn / urlbuild.py
Created August 13, 2021 09:25
url builder in python
# coding: utf-8
from urllib.parse import urlunparse, ParseResult, urlencode, quote, unquote
def url_builder(
netloc=None, hostname=None, port=None, username=None, password=None,
scheme='http', params='', fragment='', path=(), query=dict()):
"""
build an url from the fields returned by urlparse.
please note, path may be an iterable of unicode strings, or
a string made of parts that each of them is quoted, joined by '/'
@alexbodn
alexbodn / wildfly-install.sh
Created February 2, 2016 10:25 — forked from sukharevd/wildfly-install.sh
Script to install JBoss Wildfly 10.x as service in Linux
#!/bin/bash
#title :wildfly-install.sh
#description :The script to install Wildfly 10.x
#more :http://sukharevd.net/wildfly-8-installation.html
#author :Dmitriy Sukharev
#date :2015-10-24T17:14-0700
#usage :/bin/bash wildfly-install.sh
#tested-version :10.0.0.CR3
#tested-distros :Debian 7,8; Ubuntu 15.10; CentOS 7; Fedora 22