Skip to content

Instantly share code, notes, and snippets.

Romell D.Z. romellfudi

View GitHub Profile
@romellfudi
romellfudi / android.buttom.java
Last active Mar 23, 2019
Prevent Double clicks on buttom
View android.buttom.java
public class OnClickRate implements View.OnClickListener {
private final static int CLICK_DELAY_DEFAULT = 300;
private View.OnClickListener onClickListener;
private int mClickDelay;
public OnClickRateLimitedDecoratedListener(View.OnClickListener onClickListener) {
this(onClickListener, CLICK_DELAY_DEFAULT);
}
@romellfudi
romellfudi / jupyter.simple.py
Last active Jan 22, 2019
simple init code from data science workspace
View jupyter.simple.py
import warnings
warnings.filterwarnings(action='once')
warnings.simplefilter('ignore' )
%matplotlib inline
%config InlineBackend.figure_format = 'retina'
import matplotlib.pyplot as plt
plt.rcParams['figure.figsize'] = (18,6)
from IPython.display import clear_output
import numpy as np
@romellfudi
romellfudi / 4_classifiers.py
Created Jan 14, 2019
print 4 plots using grid area
View 4_classifiers.py
def make_meshgrid(x, y, h=.02):
x_min, x_max = x.min() - 1, x.max() + 1
y_min, y_max = y.min() - 1, y.max() + 1
xx, yy = np.meshgrid(np.arange(x_min, x_max, h),
np.arange(y_min, y_max, h))
return xx, yy
def plot_contours(ax, clf, xx, yy, **params):
Z = clf.predict(np.c_[xx.ravel(), yy.ravel()])
View copy_structure.sh
rsync -a --include '*/' --include '*.html' --include '*.png' --exclude '*'
@romellfudi
romellfudi / productFlavors.gradle3.3.gradle
Created Dec 26, 2018
flavors at android 3 with gradle 3.3
View productFlavors.gradle3.3.gradle
flavorDimensions "dimension"
productFlavors{
pro{
dimension "dimension"
applicationIdSuffix ".demo"
versionNameSuffix "-demo"
}
dev{
dimension "dimension"
applicationIdSuffix ".full"
@romellfudi
romellfudi / android_avd.sh
Last active Dec 17, 2018
avd, android, emulator
View android_avd.sh
cd ~/Library/Android/sdk/tools/bin && ./avdmanager list avd
cd ~/Library/Android/Sdk/tools && ./emulator -avd Nexus_5X_API_26
View secret_codes.txt
┌──────────────────────────────────────────────────┬───────────────────────┐
| Code | Description |
├──────────────────────────────────────────────────┼───────────────────────┤
| *#0011# | GSM Infos |
| *#0228# | Battery Infos |
| **05*<PUK>*<new PIN>*<new PIN for confirmation># | Unlock PIN |
| *#*#0588#*#* | Test Proximity sensor |
| *#06# | Show IMEI |
| *#*#1234#*#* | Firmware Info |
| *135# | Show your phone number|
@romellfudi
romellfudi / android_photo.java
Created Dec 10, 2018
Take a photo in Android N
View android_photo.java
private void selectImage() {
final CharSequence[] options = {"Take Photo", "Choose From Gallery", "Cancel"};
android.support.v7.app.AlertDialog.Builder builder = new android.support.v7.app.AlertDialog.Builder(this);
builder.setTitle("Select Option");
builder.setItems(options, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int item) {
StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
StrictMode.setVmPolicy(builder.build());
if (options[item].equals("Take Photo")) {
View git-commands.sh
Comandos Git
.gitconfig <----> se puede encontrar en el entorno del sistema en la carpeta /etc/gitconfig
.gitconfig <----> se puede encontrar en el entorno del usuario en la carpeta ~
git config --global user.name "John Doe" <----> para identificar tu identidad
git config --global user.email johndoe@example.com <----> para identificar tu email
.gitconfig <----> se puede encontrar en el directorio del repositorio git en la carpeta .git/config
git config --list <----> para listar tu configuracion
git config [clave] <----> para ver el valor de esa clave (user.name)
.gitingnore <----> Archivo donde indicamos patrones de archivos que queremos ignorar
git init <----> Inicia un repositorio
@romellfudi
romellfudi / meshgrid_ predict_proba.py
Last active Dec 1, 2018
Plot predict data into an area
View meshgrid_ predict_proba.py
X0_tp, X0_fp = X0[tp0], X0[~tp0]
X1_tp, X1_fp = X1[tp1], X1[~tp1]
alpha = 0.5
# class 0: dots
plt.plot(X0_tp[:, 0], X0_tp[:, 1], 'o', alpha=alpha,
color='red', markeredgecolor='k')
plt.plot(X0_fp[:, 0], X0_fp[:, 1], '*', alpha=alpha,
color='#990000', markeredgecolor='k') # dark red
You can’t perform that action at this time.