Skip to content

Instantly share code, notes, and snippets.

View AlexMeuer's full-sized avatar

Alex Meuer AlexMeuer

View GitHub Profile
@AlexMeuer
AlexMeuer / SequentialFileDownloader.java
Created August 15, 2017 09:08
Downloads files one by one to the app's internal storage. Logs a warning if a file already exists but does not stop the download. Uses guava for string testing.
package foo.bar
import android.content.Context;
import android.support.annotation.FloatRange;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.WorkerThread;
import android.util.Log;
import com.google.common.base.Strings;
@AlexMeuer
AlexMeuer / HighlightableBitmapDrawable.java
Created August 9, 2017 11:01
Simple Drawable extension to allow highlighting regions of a single image. Also allows an overlay to be drawn on top of the selection (I've use a bitmap for the overlay, but using a color instead is straightforward and follows the same technique as darkening the surrounding area).
package foo.bar;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.Region;
import android.graphics.drawable.BitmapDrawable;
import android.support.annotation.ColorRes;
@AlexMeuer
AlexMeuer / html_image_map_to_json.py
Last active August 1, 2017 08:48
Converts a html image map into a json array where (optionally) each coordinate is transformed into a percentage (0.0 -> 1.0) based on the given width and height.
#!/usr/bin/env python
from __future__ import division
import sys
import argparse
import xml.etree.ElementTree as ET
import os.path
py3 = sys.version_info[0] > 2 # Check if python2 or python3
@AlexMeuer
AlexMeuer / set_sail.sh
Last active June 22, 2018 11:14
Pipe some input to and set sail! UPDATE: Now works on MacOS (tested with iTerm) and no longer clutters terminal history! :D
#!/bin/bash
# Name: set_sail
#
# Description: This is a little script to make terminal output less dull.
# Just direct stuff into the scripts stdin and you'll set sail!
# Output can be slowed by passing --slow or -s as the first argument, you can also,
# optionally, specify how long to wait between outputs if using the slow options.
#
# Example use: cat <some_file> | set_sail --slow 1
@AlexMeuer
AlexMeuer / boost_installer.bat
Created April 6, 2017 13:58
Interactive script to install C++ BOOST library for Visual Studio 2013 or 2015
@echo off
title Boost Installer --- C00165681 v1.0
color a
echo Copyright (c) 2016 Alexander Meuer
echo.
echo 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:
echo.
echo The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
echo.
echo THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CO