Skip to content

Instantly share code, notes, and snippets.

View Fast0n's full-sized avatar

Massimiliano Montaleone Fast0n

View GitHub Profile
@Fast0n
Fast0n / checkMail.txt
Last active June 6, 2018 00:36
Check Mail Android Studio
/**
* Controllo se il campo è una mail
*/
public static boolean isEmail(String email) {
String expression = "^[\\w\\.]+@([\\w]+\\.)+[A-Z]{2,7}$";
CharSequence inputString = email;
Pattern pattern = Pattern.compile(expression, Pattern.CASE_INSENSITIVE);
Matcher matcher = pattern.matcher(inputString);
return matcher.matches();
}
@Fast0n
Fast0n / generateRandomString.txt
Last active June 17, 2022 15:26
Generate Random Password String Android Studio
import java.util.Random;
public class GeneratePassword {
/**
* Genera una password RANDOM
*/
public static final String DATA = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz|!£$%&/=@#";
public static Random RANDOM = new Random();
@Fast0n
Fast0n / checkInternetConnection.txt
Last active June 5, 2018 23:53
Check internet connection Android Studio
#### AndroidManifest.xml ####
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
#### MainActivity.java ####
public boolean isOnline() {
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
return (cm != null ? cm.getActiveNetworkInfo() : null) != null && cm.getActiveNetworkInfo().isConnectedOrConnecting();
@Fast0n
Fast0n / Example use FacePy
Created April 16, 2018 07:30
FacePyExample
from facepy import GraphAPI
# Initialize the Graph API with a valid access token (optional,
# but will allow you to do all sorts of fun stuff).
graph = GraphAPI("")
# Get my latest posts
last_posts = graph.get('me/posts')
message = last_posts['data'][0]['message']
story = last_posts['data'][0]['story']
@Fast0n
Fast0n / change_recent_apps_title_color
Last active April 27, 2018 08:58
change recent apps title color?
Bitmap bm = BitmapFactory.decodeResource(getResources(), app_icon);
TaskDescription taskDesc = new TaskDescription(getString(R.string.app_name), bm, getResources().getColor(R.color.primary_600));
MainActivity.setTaskDescription(taskDesc);
#Fonte
- https://stackoverflow.com/a/27703150
@Fast0n
Fast0n / Multiple callback query handlers telepot
Last active May 21, 2018 15:50
Multiple callback query handlers telepot
from settings import token, start_msg, client_file
from telepot.loop import MessageLoop
from telepot.namedtuple import ReplyKeyboardMarkup, ReplyKeyboardRemove, InlineKeyboardMarkup, InlineKeyboardButton
from time import sleep
import os
import sys
import telepot
def on_chat_message(msg):
@Fast0n
Fast0n / README.md
Created October 14, 2020 23:47
Installare openKirin su Huawei P9 EVA-L09

Questa guida serve per rendere semplice un processo di installazione che online non si trova ne sotto forma di video ne di spiegazione guidata.

Per installare openKirin su HP9 bisogna avere dei pre-requisiti:
  • ADB installato sul proprio pc
  • Bootloader sbloccato
Piccole nozioni di base:
  • Entrare in Fastboot Mode Da telefono spento, collegare il telefono al pc tenendo premuto il tasto Vol-