Skip to content

Instantly share code, notes, and snippets.

export GRADLE_DEFAULT_OPTS='--offline'
function upfind() {
dir=`pwd`
while [ "$dir" != "/" ]; do
@MichaelEvans
MichaelEvans / copr.md
Created January 13, 2020 00:03 — forked from gvaughn/copr.md
git copr alias

I'd like to share some git aliases that you might find useful if you handle pull requests from others.

Add these to your ~/.gitconfig in the [alias] section:

copr = "!f() { git fetch -fu origin refs/pull/$1/head:pr-$1; git checkout pr-$1; } ; f"
prunepr = "!git for-each-ref refs/heads/pr-* --format='%(refname:short)' | while read ref ; do git branch -D $ref ; done"

Now you can "git copr #{pr_number}" (check out pull request is the mnemonic) and it will pull down the PR in a local branch of pr-#{pr_number} and check it out for you. To do it right, you must pronounce it "Copper" with a James Cagney gangster accent.

@MichaelEvans
MichaelEvans / copr.md
Created January 13, 2020 00:03 — forked from gvaughn/copr.md
git copr alias

I'd like to share some git aliases that you might find useful if you handle pull requests from others.

Add these to your ~/.gitconfig in the [alias] section:

copr = "!f() { git fetch -fu origin refs/pull/$1/head:pr-$1; git checkout pr-$1; } ; f"
prunepr = "!git for-each-ref refs/heads/pr-* --format='%(refname:short)' | while read ref ; do git branch -D $ref ; done"

Now you can "git copr #{pr_number}" (check out pull request is the mnemonic) and it will pull down the PR in a local branch of pr-#{pr_number} and check it out for you. To do it right, you must pronounce it "Copper" with a James Cagney gangster accent.

@MichaelEvans
MichaelEvans / Gemfile
Created July 26, 2016 15:08 — forked from neoeno/Gemfile
Pokemon Go Slack Bot
source "https://rubygems.org"
gem "httparty"
gem "geocoder"
gem "slack-poster"
@MichaelEvans
MichaelEvans / appcompat.diff
Last active March 27, 2016 13:39
Changelog for Support Libraries v23.2.0 -> v24.0.0-alpha1
diff -U 0 -N appcompat-v7-23.2.0_ff0f8a1a/android.support.v7.app.AppCompatDelegateImplV7$PanelFeatureState appcompat-v7-24.0.0-alpha1_4f276de6/android.support.v7.app.AppCompatDelegateImplV7$PanelFeatureState
--- appcompat-v7-23.2.0_ff0f8a1a/android.support.v7.app.AppCompatDelegateImplV7$PanelFeatureState 1969-12-31 19:00:00.000000000 -0500
+++ appcompat-v7-24.0.0-alpha1_4f276de6/android.support.v7.app.AppCompatDelegateImplV7$PanelFeatureState 2016-03-09 19:28:22.000000000 -0500
@@ -0,0 +1,5 @@
+public final class android.support.v7.app.AppCompatDelegateImplV7$PanelFeatureState {
+ public boolean qwertyMode;
+ public boolean hasPanelItems();
+ public void clearMenuPresenters();
+}
diff -U 0 -N appcompat-v7-23.2.0_ff0f8a1a/android.support.v7.view.WindowCallbackWrapper appcompat-v7-24.0.0-alpha1_4f276de6/android.support.v7.view.WindowCallbackWrapper
@MichaelEvans
MichaelEvans / TimeDialog.java
Created January 7, 2016 05:47
Wrapper on {@code TimePickerDialog} to control min and max times.
/**
* Wrapper on {@code TimePickerDialog} to control min and max times.
*/
public class TimeDialog extends TimePickerDialog {
private Time mMinTime;
private Time mMaxTime;
public static TimeDialog create(Context context, OnTimeSetListener callBack,
int hour, int minute, boolean is24HourView, long min, long max) {
Time time = getBoundedTime(hour, minute, min, max);
return new TimeDialog(context, callBack, time.hour, time.minute,
// Licensed under the MIT license with <3 by GitHub
/// <summary>
/// An exponential back off strategy which starts with 1 second and then 4, 9, 16...
/// </summary>
[SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")]
public static readonly Func<int, TimeSpan> ExponentialBackoff = n => TimeSpan.FromSeconds(Math.Pow(n, 2));
/// <summary>
/// Returns a cold observable which retries (re-subscribes to) the source observable on error up to the
/**
* @param intervalMs The base interval to start backing off from. The function is: attemptNum^2 * intervalMs
* @param retryAttempts The max number of attempts to retry this task or -1 to try MAX_INT times,
*/
public static <T> Observable.Transformer<T, T> backoff(final long intervalMs, final int retryAttempts) {
return new Observable.Transformer<T, T>() {
@Override
public Observable<T> call(final Observable<T> observable) {
return observable.retryWhen(
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@MichaelEvans
MichaelEvans / gist:2dbca9c68fda99ac27e0
Created February 20, 2015 19:29
Convert mp4 to gif
ffmpeg -i ${filename} -vf scale=300:-1,format=rgb8,format=rgb24 -r 15 destination.gif