Skip to content

Instantly share code, notes, and snippets.

@bozapro
bozapro / git-cleanup.sh
Created December 21, 2020 09:32 — forked from tadija/git-cleanup.sh
Git Cleanup
# https://github.com/CocoaPods/cocoapods-deintegrate
# http://stackoverflow.com/a/17824718/2165585
# http://stevelorek.com/how-to-shrink-a-git-repository.html
# http://naleid.com/blog/2012/01/17/finding-and-purging-big-files-from-git-history
# https://github.com/zuha/Zuha/wiki/Git-Reduce-Repo-Size
git stash clear
pod deintegrate
@bozapro
bozapro / CountingFileRequestBody.java
Created July 24, 2018 15:01 — forked from eduardb/CountingFileRequestBody.java
Uploading a file with a progress displayed using OkHttp
public class CountingFileRequestBody extends RequestBody {
private static final int SEGMENT_SIZE = 2048; // okio.Segment.SIZE
private final File file;
private final ProgressListener listener;
private final String contentType;
public CountingFileRequestBody(File file, String contentType, ProgressListener listener) {
this.file = file;
@bozapro
bozapro / FooAdapter.java
Created July 17, 2018 14:10 — forked from morgotth/FooAdapter.java
Recycled Pager Adapter inspired by RecyclerView
package com.example;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.Foo;
import com.example.RecycledPagerAdapter;
public class FooAdapter extends RecycledPagerAdapter<FooViewHolder> {
@bozapro
bozapro / PdfPrint.java
Created December 21, 2017 17:20
WebView PDF print
public class PdfPrint {
private static final String TAG = PdfPrint.class.getSimpleName();
private final PrintAttributes printAttributes;
public PdfPrint(PrintAttributes printAttributes) {
this.printAttributes = printAttributes;
}
public void print(final PrintDocumentAdapter printAdapter, final File path, final String fileName) {
printAdapter.onLayout(null, printAttributes, null, new PrintDocumentAdapter.LayoutResultCallback() {
@bozapro
bozapro / adb-debug-over-wifi
Created May 18, 2017 07:13 — forked from xgouchet/adb-debug-over-wifi
A script to debug an Android device over wifi
#!/bin/sh
#
# usage :
# adb-debug-over-wifi [SERIAL OF THE DEVICE]
device_serial=$1
devices_attached=`adb devices -l | grep -c "device:"`
# check the device
if [ -z "$device_serial" ]; then
@bozapro
bozapro / update_android_sdk.sh
Created March 8, 2016 23:17 — forked from tabrindle/update_android_sdk.sh
Update/install android sdk packges automatically
#!/bin/bash
# Notes:
# - To list all possible packages, run `android list sdk -all --extended`
# - If install operation fails, it may be because selected module is obsolete
# - Enable --dry-mode on `android update sdk` to show what will be installed while actually doing nothing
# - `tools` and `platform-tools` install the newest package available
# - Build Tools - build-tool-xx.x.x selects a specific version to install
# - SDK Platforms - android-{API_Level} installs the SDK Platform for XX API Level ex. android-23 or android-19
# - System Images - sys-img-{architecture}-{platform}-android-{API_Level} ex. sys-img-x86_64-android-23 or sys-img-armeabi-v7a-android-23
<?xml version="1.0" standalone="no"?>
<!DOCTYPE database SYSTEM "file:///System/Library/DTDs/CoreData.dtd">
<database>
<databaseInfo>
<version>134481920</version>
<UUID>C709DDA5-99FC-4C0D-8C91-5F1058A596A9</UUID>
<nextObjectID>156</nextObjectID>
<metadata>
<plist version="1.0">
package com.sjl.util;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import java.util.List;
/*
* Copyright (C) 2014 Chris Banes
*
* 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