Skip to content

Instantly share code, notes, and snippets.

View martyglaubitz's full-sized avatar

Marty Glaubitz martyglaubitz

View GitHub Profile
@martyglaubitz
martyglaubitz / sitemap_lighthouse.py
Last active May 21, 2021 08:22
Script which given a URL to a Sitemap, takes each URL and performs a Lighthouse check on it
import csv
import dataclasses
import json
import io
import os
import os.path
import subprocess
import sys
import urllib.parse
import urllib.request
@martyglaubitz
martyglaubitz / check_sitemap.py
Created May 6, 2020 11:41
Check urls in sitemap
import csv
import datetime
import io
import sys
import urllib.request
import xml.dom.minidom
def get_sitemap_urls(sitemap_url):
response = urllib.request.urlopen(sitemap_url)
@martyglaubitz
martyglaubitz / select_driver.cpp
Last active September 7, 2019 12:20
Utility to automatically select the best suitable video driver for Irrlicht
#include <iostream>
#include "select_driver.h"
IrrlichtDevice* createDeviceWithBestGraphicsDriver(dimension2d<u32> resolution)
{
for (auto driverType : driverTypesByPreference)
{
IrrlichtDevice *result = createDevice( driverType, resolution, 16,
@martyglaubitz
martyglaubitz / jcr2sqlite.py
Created July 6, 2017 18:20
Creates an SQLite database from a Magnolia JSON dump
import json
import sqlite3
def load_jcr_json(filePath: str):
with open(filePath) as file:
return json.load(file)
nodes_scheme = '''
CREATE TABLE IF NOT EXISTS nodes (
@martyglaubitz
martyglaubitz / FragmentNavigationManager.kt
Last active December 8, 2015 14:29
Utlity classes to enable the handling of backpressed in Fragments
interface FragmentNavigationManager {
fun onNavigateUp(): Boolean
fun registerUpNavigationListener(upNavigationListener: UpNavigationListener)
fun unregisterUpNavigationListener(upNavigationListener: UpNavigationListener)
}
@martyglaubitz
martyglaubitz / SubjectClickListener.java
Created October 26, 2015 21:59
A reusable click listener which emits an object on click
package de.schlankr.utils;
import android.support.annotation.IdRes;
import android.view.View;
import rx.subjects.PublishSubject;
public class SubjectClickListener <V> implements View.OnClickListener {
public static <V> SubjectClickListener<V> get(final PublishSubject<V> publishSubject, final View clickTarget, final View tagTarget, @IdRes final int listenerId) {
@martyglaubitz
martyglaubitz / gist:9d258a1ac3dd701b1c35
Created June 10, 2015 11:45
PostgreSQL start/stop under mac

#STOP launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

#START launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

@martyglaubitz
martyglaubitz / env.bat
Created March 31, 2015 12:37
Scripts to get node_modules bins into the path
path=%PATH%;node_modules\.bin
@martyglaubitz
martyglaubitz / hprof.py
Created February 12, 2015 12:18
A python script to pull humpdump from an android device/emulat, which can be opened with Eclipse MAT
#!/usr/bin/python -u
import argparse
import subprocess
import time
parser = argparse.ArgumentParser(description='Pull a memory profile of an running process')
parser.add_argument('pid', nargs='+', help='The apps process id')
args = parser.parse_args()
@martyglaubitz
martyglaubitz / GaussianBlurTransformation.java
Last active September 3, 2017 13:31
A gaussian blur transformation for picasso, using renderscript.
import android.content.Context;
import android.graphics.Bitmap;
import android.support.v8.renderscript.Allocation;
import android.support.v8.renderscript.Element;
import android.support.v8.renderscript.RenderScript;
import android.support.v8.renderscript.ScriptIntrinsicBlur;
import com.squareup.picasso.Transformation;
public class GaussianBlurTransformation implements Transformation {