Skip to content

Instantly share code, notes, and snippets.

View BaloghTamas's full-sized avatar

Tamas Balogh BaloghTamas

View GitHub Profile
alias adb_wifi='function _adb_wifi() {
DEBUG_PORT=`nmap -sT -p30000-45000 $1 |\
tail -n 3 |\
head -n 1 |\
sed -r "s/([1-9][0-9]+)(\/tcp.+)/\1/"`
adb connect $1:$DEBUG_PORT
};_adb_wifi'
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package mobileforum;
/**
*
@BaloghTamas
BaloghTamas / SelfSignedClientFactory.java
Created June 22, 2015 19:21
BKS + Self signed cert + Retrofit&OkHttp
package hu.aut.sensorhub.network.https;
import com.squareup.okhttp.OkHttpClient;
import android.content.Context;
import android.support.annotation.RawRes;
import java.io.IOException;
import java.io.InputStream;
import java.security.KeyManagementException;
import com.google.gson.Gson;
import android.content.Context;
import android.content.SharedPreferences;
import android.util.Log;
import java.lang.reflect.Type;
public class Eagle
@BaloghTamas
BaloghTamas / contact_photo.java
Last active August 29, 2015 14:19
load contact photo
public static Bitmap loadContactPhoto(ContentResolver cr, String uri) {
InputStream input = ContactsContract.Contacts.openContactPhotoInputStream(cr, uri);
if (input == null) {
return null;
}
return BitmapFactory.decodeStream(input);
}
@BaloghTamas
BaloghTamas / snippet.java
Last active August 29, 2015 14:19
Contact info by name
public Contact getContactByNumber(String number)
{
Uri uri = Uri.withAppendedPath(ContactsContract.PhoneLookup.CONTENT_FILTER_URI, Uri.encode(number));
Contact contact = new Contact();
ContentResolver contentResolver = context.getContentResolver();
Cursor contactLookup = null;
try
{
public class MainThreadBus extends Bus
{
public MainThreadBus(ThreadEnforcer enforcer)
{
super(enforcer);
}
private final Handler mHandler = new Handler(Looper.getMainLooper());