Skip to content

Instantly share code, notes, and snippets.

@JakeWharton
JakeWharton / authorpurge.py
Created August 15, 2012 19:29
Purge all @author tags!
#!/usr/bin/env python
import os
import re
os.system('git reset --hard HEAD')
os.system('git clean -fdx')
REs = [
r'''\s+\*\n\s+\* @author[^\n]*''',
/*
* Copyright (C) 2016 Jesse Wilson
*
* 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
*
* Unless required by applicable law or agreed to in writing, software
@dlew
dlew / androidmanifest.xml
Created May 1, 2015 20:05
Fully supporting "note to self" and "take a note" on Android
<activity
android:name="com.yourapp.ui.NoteTaker">
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="com.google.android.voicesearch.SELF_NOTE" />
<data android:mimeType="*/*" />
</intent-filter>
@autovalue
autovalue / ConverterCallAdapterFactory.java
Created April 5, 2017 21:31
Retrofit ConverterCallAdapterFactory implementation. A way to use the current request to convert the ResponseBody to a different class type.
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import okhttp3.Request;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.CallAdapter;
package com.publicobject.quine;
import com.squareup.javapoet.FieldSpec;
import com.squareup.javapoet.JavaFile;
import com.squareup.javapoet.MethodSpec;
import com.squareup.javapoet.TypeSpec;
import javax.lang.model.element.Modifier;
class Quine {
static String PACKAGE = "com.publicobject.quine";
package com.squareup.refmt
import okio.Okio
import java.io.File
fun main(args: Array<String>) {
val directory = File(args[0])
Reformatter().reformatDirectory(directory)
}
@jameshartig
jameshartig / ioCrawler.go
Last active September 19, 2018 00:23
Google I/O 2014 redeem easter egg crawler
//before running make sure you setup a GOPATH env variable and ran: "go get code.google.com/p/go.net/html"
//to run: go run ioCrawler.go -url="http://developers.google.com/"
//also try http://developer.android.com/index.html
//output goo.gl links to try and redeem will be sent to foundLinks.txt
//by the way there's an artificial "rate limit" in func crawler, you can lower that or raise it as you wish
//You can also comment out the onlyGoogleRegex code if you don't want to limit to google.com/youtube
//if you're getting I/O timeout errors, then you might need to increase the timeouts on line 231
@alexjlockwood
alexjlockwood / piazza.py
Last active September 4, 2019 22:59
Authenticating with Piazza's Internal REST API
import urllib2
from cookielib import CookieJar
cj = CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
# login to Piazza.
login_url = 'https://piazza.com/logic/api?method=user.login'
login_data = '{"method":"user.login","params":{"email":"alockwoo@andrew.cmu.edu","pass":"fakePassword"}}'
@stephenlb
stephenlb / animated-gif.md
Last active October 31, 2020 22:57
DIY How to make your own HD Animated GIF Generator

HD Animated GIF Generator

You can make your own HD animated GIF generator.
Follow along with these commands to get started.

HD Animated GIF Generator

git clone git://source.ffmpeg.org/ffmpeg.git
cd ffmpeg
@pyricau
pyricau / LeakSlackUploadService.java
Created May 9, 2015 00:03
Sending Leak Traces to a Slack Channel (and HipChat, see the comments)
import android.util.Log;
import com.squareup.leakcanary.AnalysisResult;
import com.squareup.leakcanary.DisplayLeakService;
import com.squareup.leakcanary.HeapDump;
import retrofit.RestAdapter;
import retrofit.RetrofitError;
import retrofit.http.Multipart;
import retrofit.http.POST;
import retrofit.http.Part;
import retrofit.mime.TypedFile;