Skip to content

Instantly share code, notes, and snippets.

View chrisgraf's full-sized avatar

chrisgraf

View GitHub Profile
@frankrowe
frankrowe / shp2gj.py
Last active November 1, 2022 17:54
PyShp, shp to geojson in python
import shapefile
# read the shapefile
reader = shapefile.Reader("my.shp")
fields = reader.fields[1:]
field_names = [field[0] for field in fields]
buffer = []
for sr in reader.shapeRecords():
atr = dict(zip(field_names, sr.record))
geom = sr.shape.__geo_interface__
buffer.append(dict(type="Feature", \
@AdamMadrzejewski
AdamMadrzejewski / jAuthentication.php
Last active January 16, 2020 10:50
Joomla 3 External authentication script
<?php
/**
* Joomla! External authentication script
*
* @author vdespa
* Version 1.0
*
* Code adapted from /index.php
*
* @package Joomla.Site
@discordianfish
discordianfish / prometheus
Created February 6, 2015 14:43
sysvinit prometheus init script
#!/bin/sh
### BEGIN INIT INFO
# Provides: prometheus
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Should-Start:
# Should-Stop:
# Default-Start: S
# Default-Stop:
@h3po
h3po / prometheus-urbackup-exporter.py
Last active August 1, 2021 21:05
Simple proof of concept script for exporting urbackup status to prometheus, using prometheus_client and urbackup-server-web-api-wrapper packages
#!/usr/bin/env python3
import urbackup_api
def floatWithDefault(x, default=0.0):
try:
return float(x)
except ValueError:
return default