Skip to content

Instantly share code, notes, and snippets.

View mxttwoods's full-sized avatar
🎯
Focusing

Matthew Woods mxttwoods

🎯
Focusing
View GitHub Profile
@mxttwoods
mxttwoods / git-ignore-line.sh
Created January 26, 2023 14:41 — forked from aryelgois/git-ignore-line.sh
Git filter to ignore lines in your files
#!/bin/sh
# Git filter to ignore lines in your files.
#
# Copyright (c) 2017-2019 Aryel Mota Góis <aryel.gois@gmail.com>
#
# MIT License
#
#
# SETUP:
#
@mxttwoods
mxttwoods / buffer_in_meters.py
Created July 14, 2022 19:26 — forked from joaofig/buffer_in_meters.py
Python code to convert a geographic point into a circular buffer with radius in meters.
from shapely.geometry import Point
from functools import partial
from shapely.ops import transform
import pyproj
def buffer_in_meters(lng, lat, radius):
proj_meters = pyproj.Proj(init='epsg:3857')
proj_latlng = pyproj.Proj(init='epsg:4326')
project_to_meters = partial(pyproj.transform, proj_latlng, proj_meters)
@mxttwoods
mxttwoods / kml_io.py
Created March 28, 2022 14:13 — forked from mazzma12/kml_io.py
IO / Read and write KML file with geopandas and fiona driver
import fiona
import geopandas as gpd
# Enable fiona driver
gpd.io.file.fiona.drvsupport.supported_drivers['KML'] = 'rw'
# Read file
df = gpd.read_file(path, driver='KML')
# Write file
@mxttwoods
mxttwoods / custom-log-filtering-and-formatting.py
Created March 1, 2022 14:00 — forked from acdha/custom-log-filtering-and-formatting.py
Example of how to filter or apply custom formatting using Python's logging library
#!/usr/bin/env python
# encoding: utf-8
from pprint import pformat, pprint
import logging
class PasswordMaskingFilter(logging.Filter):
"""Demonstrate how to filter sensitive data:"""
@mxttwoods
mxttwoods / .gitattributes
Created January 17, 2022 19:51 — forked from dreftymac/.gitattributes
Sample Git Attributes File
# Encrypt the repository
# Remove/modify this line if the repository is meant to be open-source
*.* filter=git-crypt diff=git-crypt
.gitattributes !filter !diff
# These files are text and should be normalized (Convert crlf => lf)
*.php text
*.css text
*.js text
*.htm text
@mxttwoods
mxttwoods / hndlr.py
Created December 14, 2021 16:28 — forked from giumas/Logging - SQLite handler
A minimal SQLite handler for the python logging module
from __future__ import absolute_import, division, print_function, unicode_literals
import sqlite3
import logging
import time
__version__ = "0.1.0"
initial_sql = """CREATE TABLE IF NOT EXISTS log(
@mxttwoods
mxttwoods / powerssh.ps1
Created November 5, 2021 16:35 — forked from sveinn-steinarsson/powerssh.ps1
Use Powershell to connect to a remote server via SSH and run a shell script/command
# Script Name: powerssh
# Version: 1.1.0 (9. July, 2014)
# Author: Sveinn Steinarsson
# Description: Use Powershell to connect to a remote server via SSH and run a shell script/command
# Prerequisite:
# plink.exe in script path (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html)
# Examples:
# With key file (*.ppk) and script file
@mxttwoods
mxttwoods / progress.py
Last active September 6, 2021 17:26 — forked from vladignatyev/progress.py
Python command line progress bar in less than 10 lines of code.
import sys
def progress(count, total, status=''):
bar_len = 60
filled_len = int(round(bar_len * count / float(total)))
percents = round(100.0 * count / float(total), 1)
bar = '=' * filled_len + '-' * (bar_len - filled_len)
@mxttwoods
mxttwoods / wildfly_httpcache.md
Created August 31, 2021 14:31 — forked from remibantos/wildfly_httpcache.md
Wildfly 8 - HTTP cache headers tuning for rich client web application

Introduction

This Gist describes how to tune HTTP browser cache expiration for static contents served by Wildfly Undertow web server, as per RFC-2616 section 13.

Wildfly configuration

Description

In order to change HTTP browser cache behavior, a "Cache-Control" HTTP header has to be added to static content HTTP responses returned by Undertow.

Undertow subsystem configuration (standalone.xml)

@mxttwoods
mxttwoods / scala_2.11.6_install.sh
Created July 22, 2021 18:32 — forked from bkasper/scala_2.11.6_install.sh
Installing Scala 2.11.6 on a fresh CentOS 6.5 image.
#!/bin/bash
#
# Installs Scala 2.11.6 on a fresh CentOS 6.5 image.
sudo yum update -y
sudo yum install -y wget
# Scala
wget http://www.scala-lang.org/files/archive/scala-2.11.6.tgz