This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RxJavaPlugins.setErrorHandler { e -> | |
var error : Throwable? = e | |
if (error is UndeliverableException) { | |
error = e.cause | |
} | |
if (error is IOException || error is SocketException) { | |
// fine, irrelevant network problem or API that throws on cancellation | |
return@setErrorHandler | |
} | |
if (error is InterruptedException) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
reload(sys) | |
sys.setdefaultencoding('utf-8') | |
import csv; | |
import gdata.docs.service | |
import gdata.spreadsheet.service | |
from xml.etree.ElementTree import Element, ElementTree, SubElement, dump |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val NOTIFICATION_ID = 1001; | |
createNotificationChannel(this, NotificationManagerCompat.IMPORTANCE_HIGH, false, | |
getString(R.string.app_name), "App notification channel") // 1 | |
val channelId = "$packageName-${getString(R.string.app_name)}" | |
val title = "Android Developer" | |
val content = "Notifications in Android P" | |
val intent = Intent(baseContext, NewActivity::class.java) | |
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class log { | |
public static final String tag = "phkim"; | |
public final static boolean debug = BuildConfig.DEBUG; | |
public static void l() { | |
try { | |
if (debug) { | |
Exception e = new Exception(); | |
StackTraceElement[] element = e.getStackTrace(); | |
Log.d(tag, "("+element[1].getFileName()+":"+element[1].getLineNumber()+")"+"\t"+element[1].getMethodName() ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void tAdbTcpip() { | |
Thread t = new Thread(() -> { | |
try { | |
Process proc = Runtime.getRuntime() | |
.exec(new String[]{ "su", "-c", "setprop service.adb.tcp.port 5555" }); | |
proc.waitFor(); | |
proc = Runtime.getRuntime() | |
.exec(new String[]{ "su", "-c", "stop adbd" }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val d = Observable.just(CertificatePinning(도메인)) | |
.subscribeOn(Schedulers.io()) | |
.map { | |
it.myCert("https://도메인포함 URL") | |
} | |
.subscribe( | |
{ | |
System.out.println() | |
}, | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import okhttp3.CertificatePinner | |
import okhttp3.OkHttpClient | |
import okhttp3.Request | |
import java.io.IOException | |
class CertificatePinning(dmoain: String){ | |
private val client: OkHttpClient = OkHttpClient.Builder() | |
.certificatePinner( | |
CertificatePinner.Builder() | |
.add(dmoain, "sha256/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
drawerLayout.addDrawerListener(object : DrawerLayout.DrawerListener { | |
private val scaleFactor = 6f | |
override fun onDrawerSlide(drawerView: View, slideOffset: Float) { | |
val slideX = drawerView.width * slideOffset | |
contentFrame.translationX = slideX | |
contentFrame.scaleX = 1 - slideOffset / scaleFactor | |
contentFrame.scaleY = 1 - slideOffset / scaleFactor | |
} | |
override fun onDrawerClosed(drawerView: View) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
drawerLayout.addDrawerListener(object : DrawerLayout.DrawerListener { | |
override fun onDrawerSlide(drawerView: View, slideOffset: Float) { | |
val slideX = drawerView.width * slideOffset | |
contentFrame.translationX = slideX | |
} | |
override fun onDrawerClosed(drawerView: View) { | |
} | |
override fun onDrawerOpened(drawerView: View) { |