This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| https://gist.github.com/pkavoo/a6a80d96d8f54f592827dbde96fc08bd |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1. Generate a New SSH Key Pair | |
| Open your terminal (or Git Bash on Windows) and run the following command. The ed25519 algorithm is the recommended standard for security. | |
| Bash | |
| ssh-keygen -t ed25519 -C "[email protected]" | |
| Replace "[email protected]" with the email address associated with your GitHub account. | |
| Prompt 1 (File location): Press Enter to accept the default location (usually ~/.ssh/id_ed25519). If you already have a key, it's best to enter a new name (e.g., ~/.ssh/github_id_ed25519). | |
| Prompt 2 (Passphrase): Enter a secure passphrase to protect your private key (recommended for extra security). You will be prompted to enter this passphrase when you use the key. Press Enter twice if you do not want a passphrase. | |
| This creates two files in the .ssh directory: | |
| id_ed25519: Your private key (keep this secret and safe). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.HashMap; | |
| import java.util.Map; | |
| import java.util.Scanner; | |
| import java.util.InputMismatchException; | |
| // Account class representing a bank account | |
| class Account { | |
| private int accountNumber; | |
| private String accountHolder; | |
| private double balance; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public boolean isGPSEnabled(Context mContext) { | |
| LocationManager locationManager = (LocationManager) mContext.getSystemService(Context.LOCATION_SERVICE); | |
| return locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static boolean isInternetConnected(Context ctx) { | |
| ConnectivityManager connectivityMgr = (ConnectivityManager) ctx | |
| .getSystemService(Context.CONNECTIVITY_SERVICE); | |
| NetworkInfo wifi = connectivityMgr.getNetworkInfo(ConnectivityManager.TYPE_WIFI); | |
| NetworkInfo mobile = connectivityMgr.getNetworkInfo(ConnectivityManager.TYPE_MOBILE); | |
| // Check if wifi or mobile network is available or not. If any of them is | |
| // available or connected then it will return true, otherwise false; | |
| if (wifi != null) { | |
| if (wifi.isConnected()) { | |
| return true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private LocationManager locationManager; | |
| private android.location.LocationListener myLocationListener; | |
| public void checkLocation() { | |
| String serviceString = Context.LOCATION_SERVICE; | |
| locationManager = (LocationManager) getSystemService(serviceString); | |
| if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import tweepy | |
| import csv | |
| import pandas as pd | |
| ####input your credentials here | |
| consumer_key = '' | |
| consumer_secret = '' | |
| access_token = '' | |
| access_token_secret = '' | |
| auth = tweepy.OAuthHandler(consumer_key, consumer_secret) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import com.google.android.gms.maps.model.LatLng; | |
| import static java.lang.Math.asin; | |
| import static java.lang.Math.atan2; | |
| import static java.lang.Math.cos; | |
| import static java.lang.Math.pow; | |
| import static java.lang.Math.sin; | |
| import static java.lang.Math.sqrt; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import android.os.Handler; | |
| import android.os.SystemClock; | |
| import android.view.animation.AccelerateDecelerateInterpolator; | |
| import android.view.animation.Interpolator; | |
| import com.google.android.gms.maps.model.LatLng; | |
| import com.google.android.gms.maps.model.Marker; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import android.Manifest; | |
| import android.content.pm.PackageManager; | |
| import android.location.Location; | |
| import android.os.Build; | |
| import android.os.Bundle; | |
| import android.os.Looper; | |
| import android.view.View; | |
| import android.widget.Toast; | |
| import androidx.annotation.NonNull; |
NewerOlder