Skip to content

Instantly share code, notes, and snippets.

View dbazile's full-sized avatar

David Bazile dbazile

View GitHub Profile
def read_triples(file_path):
"""
Read a .DT? file and returns generator that yields one pixel at a time
:rtype: float, float, int
GDAL's Python bindings can be weird; this is good reading:
https://trac.osgeo.org/gdal/wiki/PythonGotchas
"""
#!/usr/bin/python
import argparse
import logging
import os
import time
from osgeo import ogr, gdal
@dbazile
dbazile / postgres-on-centos.dockerfile
Created August 2, 2019 18:08
PostgreSQL+PostGIS on CentOS
FROM centos:7
RUN set -ex \
&& yum install -y epel-release \
&& yum install -y \
--setopt='tsflags=nodocs' \
--setopt='group_package_types=mandatory' \
gdal \
gdal-libs \
gdal-python \
@dbazile
dbazile / du.bash
Created August 2, 2019 16:46
show disk usage of all files in a directory (including hidden ones)
du -ahcd1 | sort -h
# Reference: https://askubuntu.com/questions/356902/why-doesnt-this-show-the-hidden-files-folders#comment914717_363681
@dbazile
dbazile / dbus.log
Last active April 24, 2019 16:22
dbus tomfoolery
signal time=1556122356.952651 sender=:1.37 -> destination=(null destination) serial=8319 path=/org/freedesktop/Notifications; interface=org.freedesktop.Notifications; member=NotificationClosed
uint32 20
uint32 2
signal time=1556122356.952963 sender=:1.37 -> destination=(null destination) serial=8321 path=/org/freedesktop/Notifications; interface=org.freedesktop.Notifications; member=NotificationClosed
uint32 20
uint32 2
method call time=1556122359.586825 sender=:1.91 -> destination=:1.37 serial=339 path=/org/freedesktop/Notifications; interface=org.freedesktop.Notifications; member=CloseNotification
uint32 0
method call time=1556122380.854189 sender=:1.91 -> destination=:1.37 serial=345 path=/org/freedesktop/Notifications; interface=org.freedesktop.Notifications; member=Notify
string "Evolution Reminders"
@dbazile
dbazile / mcast.py
Last active April 21, 2019 00:03
multicast CLI utility
#!/usr/bin/python3
import argparse
import socket
ap = argparse.ArgumentParser()
ap.add_argument('-l', '--listen', dest='op', const='listen', action='store_const')
ap.add_argument('-s', '--send', dest='op', const='send', action='store_const')
ap.add_argument('-b', '--bind-addr', default='0.0.0.0')
#!/bin/bash
# ref: https://github.com/moby/moby/blob/master/contrib/mkimage-yum.sh
set -e
cd $(dirname $0)
set -x
IMAGE_NAME=dave/centos
import time
import gobject
def tick():
while True:
time.sleep(1)
gobject.threads_init()
@dbazile
dbazile / Publisher.java
Created February 2, 2019 01:54
multicast send/recv in Java & Python
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.InetAddress;
import java.net.MulticastSocket;
public class Publisher {
static final String GROUP = "225.0.0.1";
static final int PORT = 5000;
public static void main(String[] args) throws IOException {
@dbazile
dbazile / nexus-scrape.gradle
Last active December 6, 2018 01:45
scrape some artifacts from Nexus repo in Gradle
apply plugin: 'java'
ext {
NEXUS_CENTRAL = 'http://localhost:8081/nexus/content/repositories/central'
NEXUS_RELEASES = 'http://localhost:8081/nexus/content/repositories/releases'
}
repositories {
maven {
url 'http://localhost:8081/nexus/content/groups/public'