Skip to content

Instantly share code, notes, and snippets.

View AndrewReitz's full-sized avatar

Andrew Reitz AndrewReitz

View GitHub Profile
@AndrewReitz
AndrewReitz / watermark.sh
Last active January 2, 2016 07:29
Quick and dirty way to add a water mark to all images in a folder.
#!/bin/bash
WATERMARK="$1" #1st param image to be the water mark
#2nd param is path to folder you want all jpg, jpeg or png to
#have the water mark added to
for image in $2/*{.jpg,.jpeg,.png}
do
#gravity is the position the water mark will go
#50 is the opacity of the image
#the second $image is the output file, currently
@AndrewReitz
AndrewReitz / .bashrc
Last active January 2, 2016 10:59
My .bashrc so I can add things and remember them elsewhere
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific aliases and functions
#Exports
@AndrewReitz
AndrewReitz / downloadtable.js
Created January 8, 2014 03:39
Download a table on a website with JavaScript
// Place to store all the strings for the CSV
var stringBuilder = [];
// Get the table, this one happens to be adminlist
// Could probably make the more generic
var table = document.getElementsByClassName('adminlist')[0];
var tbody = table.getElementsByTagName('tbody')[0]
var rows = tbody.getElementsByTagName('tr');
// Loop through each row
@AndrewReitz
AndrewReitz / GenericsExampleProblem.java
Last active January 3, 2016 02:29
Generic Types Example Problem (INCOMPLETE)
public class GenericsExampleProblem {
public static void main(String[] args) {
Class myClass = MyClass.class;
Method[] myClassMethods = myClass.getDeclaredMethods();
for (Method method : myClassMethods) {
// Skip any other methods
// This must be done this way instead of with getMethod(String Name, Class<?>... params) since
// we can not possibly know the params until at run time
if (!method.getName().equals("myMethod")) {
@AndrewReitz
AndrewReitz / Netflix.md
Last active August 1, 2024 13:50
How to install Netflix on Fedora and Ubuntu
@AndrewReitz
AndrewReitz / keybase.md
Created March 18, 2014 01:12
Keybase verification

Keybase proof

I hereby claim:

  • I am pieces029 on github.
  • I am areitz (https://keybase.io/areitz) on keybase.
  • I have a public key whose fingerprint is 6513 2A0E 64C9 3BC1 EDB4 BA62 0221 9C76 97C0 FB6E

To claim this, I am signing this object:

@AndrewReitz
AndrewReitz / RxFibN.java
Created June 16, 2014 23:16
RxJava implementation of Fibonacci Number
public class Main {
public static void main(String[] args) {
rxFibN(20).subscribe(new Action1<Integer>() {
@Override public void call(Integer result) {
System.out.println(result);
}
});
}
static Observable<Integer> rxFibN(final int n) {
@AndrewReitz
AndrewReitz / CrashlyticsTree.java
Created June 21, 2014 12:51
Crashlytics Tree
public final class CrashlyticsTree extends HollowTree {
private static final Pattern ANONYMOUS_CLASS = Pattern.compile("\\$\\d+$");
private enum LogLevel {
INFO,
ERROR,
WARNING
}
@Override public void i(String message, Object... args) {
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked"
}
}
@AndrewReitz
AndrewReitz / gist:01a3e098b95ecb83fda0
Created July 17, 2014 16:10
Linux Upfind + Gradlew
# Find something in a directory above the one you are in
function upfind() {
dir=`pwd`
while [ "$dir" != "/" ]; do
path=`find "$dir" -maxdepth 1 -name $1`
if [ ! -z $path ]; then
echo "$path"
return
fi
dir=`dirname "$dir"`