Skip to content

Instantly share code, notes, and snippets.

View pollux-'s full-sized avatar

Sree Kumar A.V pollux-

View GitHub Profile
@pollux-
pollux- / overDraw.txt
Last active December 1, 2015 12:34
OverDraw Android
http://www.curious-creature.com/docs/android-performance-case-study-1.html
http://lucasr.org/2014/05/12/custom-layouts-on-android/
@pollux-
pollux- / gist:9755195ffd87cbe5c5f3
Created December 16, 2015 13:21
Finding IP adress in Mac
Find the name of your Mac using hostname (at the Terminal prompt) and use that in your URL. E.g. http://Tonys-iMac.local:3000/
If for some reason Bonjour doesn't work in your environment, find the address of the Airport on an iMac or MacBook with
## ipconfig getifaddr en1
or in general with
@pollux-
pollux- / fix.java
Created December 17, 2015 13:40
Picasso fix for image https
OkHttpClient client = new OkHttpClient();
client.setProtocols(Arrays.asList(Protocol.HTTP_1_1));
Picasso picasso = new Picasso.Builder(this).listener(new Picasso.Listener() {
@Override
public void onImageLoadFailed(Picasso picasso, Uri uri, Exception exception) {
LogUtils.LOGD(TAG, "Exception URL " + exception.getMessage());
exception.printStackTrace();
}
}) .downloader(new OkHttpDownloader(client)).build();
@pollux-
pollux- / gist:2179557c0a83217f36a6
Created February 19, 2016 01:48
Making wireless ADB connection to device
Rooting is not required. With USB cable connected, port 5555 opened across all involved firewalls and debug mode enabled
adb tcpip 5555
then look into wireless properties of your device and the network you use, to see which IP address have been granted to device (or configure your DHCP always to use the same for the device mac address). Then
adb connect 192.168.1.133
(were 192.168.1.133 is a sample IP address).
This is all. You can now use adb shell or adb install or adb upload or the like with USB cable plugged out.
@pollux-
pollux- / Tag.java
Last active February 21, 2016 16:17
Tag Id
//TODO: First Tag Id to ImageView
imageview.setImageBitmap(
decodeSampledBitmapFromResource(getResources(), R.drawable.adnuentrancecrop, 350, 100));
imageview.setTag(R.drawable.adnuentrancecrop);
//TODO: Onclick you can extract the ID
imageview.setOnClickListener(
new View.OnClickListener() {
$ wget http://repo.gradle.org/gradle/distributions/gradle-1.0-bin.zip
--2011-03-18 10:58:46-- http://repo.gradle.org/gradle/distributions/
gradle-1.0-bin.zip
Resolving repo.gradle.org... 50.16.203.43
Connecting to gradle.artifactoryonline.com |50.16.203.43|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 26899590 (26M) [application/zip]
Saving to: `gradle-1.0-bin.zip'
100%[=============================================================>]
26,899,590 171K/s in 2m 56s
@pollux-
pollux- / gitignore
Created April 14, 2016 16:14
Git ignore for android studio project
# IDEA/Android Studio ignores
*.iml
*.ipr
*.iws
**/.idea/workspace.xml
**/.idea/tasks.xml
**/.idea/datasources.xml
**/.idea/dataSources.ids
**/.idea/gradle.xml
**/.idea/misc.xml
<?xml version="1.0" encoding="UTF-8"?>
<code_scheme name="AndroidStyle">
<option name="JAVA_INDENT_OPTIONS">
<value>
<option name="INDENT_SIZE" value="4" />
<option name="CONTINUATION_INDENT_SIZE" value="8" />
<option name="TAB_SIZE" value="8" />
<option name="USE_TAB_CHARACTER" value="false" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
First of all you need to know what parts of the library the app was actually using. This can easily be done by running the following command in your src folder.
grep -roh . -e 'com.google.common.*' | sort | uniq
@pollux-
pollux- / publickey
Last active March 7, 2019 01:19
Extract the public key from a certificate
openssl s_client -connect api.github.com:443 | openssl x509 -pubkey -noout | openssl rsa -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64