Skip to content

Instantly share code, notes, and snippets.

View amirbakhtiari's full-sized avatar

amir bakhtiari amirbakhtiari

View GitHub Profile
@amirbakhtiari
amirbakhtiari / CustomView.java
Created May 26, 2019 07:45 — forked from arriolac/CustomView.java
Saving state on configuration changes for a custom view.
package com.operator.android;
import android.content.Context;
import android.os.Parcel;
import android.os.Parcelable;
import android.view.View;
/**
* A custom {@link View} that demonstrates how to save/restore instance state.
*/
@amirbakhtiari
amirbakhtiari / gist:8841286
Last active August 29, 2015 13:56
detect network adaptor in java
//detect network adaptor in java
import os
osName_ = os.name
print(osName)
import sys
import time
s = time.time()
N = int(sys.argv[1])
prime = [True]*N
prime[0] = False
prime[1] = False