Skip to content

Instantly share code, notes, and snippets.

Avatar

Marty Glaubitz martyglaubitz

View GitHub Profile
View check_sitemap.py
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 Sep 7, 2019
Utility to automatically select the best suitable video driver for Irrlicht
View select_driver.cpp
#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 Jul 6, 2017
Creates an SQLite database from a Magnolia JSON dump
View jcr2sqlite.py
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 Dec 8, 2015
Utlity classes to enable the handling of backpressed in Fragments
View FragmentNavigationManager.kt
interface FragmentNavigationManager {
fun onNavigateUp(): Boolean
fun registerUpNavigationListener(upNavigationListener: UpNavigationListener)
fun unregisterUpNavigationListener(upNavigationListener: UpNavigationListener)
}
@martyglaubitz
martyglaubitz / SubjectClickListener.java
Created Oct 26, 2015
A reusable click listener which emits an object on click
View SubjectClickListener.java
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 Jun 10, 2015
PostgreSQL start/stop under mac
View gist:9d258a1ac3dd701b1c35

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

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

@martyglaubitz
martyglaubitz / env.bat
Created Mar 31, 2015
Scripts to get node_modules bins into the path
View env.bat
path=%PATH%;node_modules\.bin
@martyglaubitz
martyglaubitz / hprof.py
Created Feb 12, 2015
A python script to pull humpdump from an android device/emulat, which can be opened with Eclipse MAT
View hprof.py
#!/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 Sep 3, 2017
A gaussian blur transformation for picasso, using renderscript.
View GaussianBlurTransformation.java
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 {
View DistributeLayout.java
/* The MIT License (MIT)
Copyright (c) 2014, Marty Glaubitz
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: