Skip to content

Instantly share code, notes, and snippets.

View ahmed-BH's full-sized avatar
💭
I may be slow to respond.

Ahmed Ben Hamouda ahmed-BH

💭
I may be slow to respond.
View GitHub Profile
@ahmed-BH
ahmed-BH / NeuralNetwork.md
Created January 13, 2020 10:17
Neural network notes taken from "Deep Learning with Python" by Nikhil Ketkar

Summary of Loss Functions

  • The Binary Cross entropy is the recommended loss function for binary classification. This loss function should typically be used when the Neural Network is designed to predict the probability of the outcome. In such cases, the output layer has a single unit with a suitable sigmoid as the activation function.

  • The Cross entropy is the recommended loss function for multi-classification. This loss function should typically be used with the Neural Network and is designed to predict the probability of the outcomes of each of the classes. In such cases, the output layer has softmax units (one for each class).

  • The squared loss function should be used for regression problems. The output layer in this case will have a single unit.

@ahmed-BH
ahmed-BH / sha256.java
Created July 23, 2019 08:39
get sha256 representation of a string in java
public static String getSHA(String input)
{
// ------ Geeks For Geeks code ---------
try {
// Static getInstance method is called with hashing SHA
MessageDigest md = MessageDigest.getInstance("SHA-256");
// digest() method called
// to calculate message digest of an input
@ahmed-BH
ahmed-BH / android_wifi_signal.java
Last active November 10, 2021 08:10
Get list of wifi networks in Android
/* ------------------------------------------------------------------------------------------------------------------------------
* SIGNAL MEANING
* -30 dBm Maximum signal strength, you are probably standing right next to the access point.
* -50 dBm Anything down to this level can be considered excellent signal strength.
* -60 dBm Good, reliable signal strength.
* -67 dBm Reliable signal strength. The minimum for any service depending on a reliable connection and signal strength, such as voice over Wi-Fi and non-HD video streaming.
* -70 dBm Not a strong signal. Light browsing and email.
* -80 dBm Unreliable signal strength, will not suffice for most services. Connecting to the network.
* -90 dBm The chances of even connecting are very low at this level.
*/ -----------------------------------------------------------------------------------------------------------------------------
@ahmed-BH
ahmed-BH / socket.java
Last active July 15, 2019 08:28
Java socket (tcp/udp) example
/*--------------------------------------------------------------------
*
* TCP Socket client
*
*------------------------------------------------------------------*/
String host = "0.0.0.0";
int port = 50236;
InetAddress server = InetAddress.getByName(host);
Socket socket = new Socket(server, port);
String message = "this is message";