Skip to content

Instantly share code, notes, and snippets.

View Gkemon's full-sized avatar
😎
Being humanized

Gk Mohammad Emon Gkemon

😎
Being humanized
View GitHub Profile
@shiponcs
shiponcs / stun_bind_request_response.cpp
Last active July 8, 2021 05:44
It simply sends an encoded STUN Bind request, and parse the Bind response to find the public IP and port. And, the Sender mimics the way a STUN server sends a Bind Response. These both file can be used together to achieve the goal of getting the public IP and port, but the server file must run in any remote host.
#include <iostream>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <string>
void printMsg(std::string msg)
{
import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewParent;
import android.view.ViewTreeObserver;
import android.widget.FrameLayout;
@HBiSoft
HBiSoft / FileUtils.java
Last active February 1, 2024 19:10
This fixes the issue when selecting a file from Downloads directory as well as the SD Card. This class can be called like this: String sourcePath = FileUtils.getRealPathFromURI_API19(this, data.getData());
import android.annotation.SuppressLint;
import android.content.ContentUris;
import android.content.Context;
import android.content.CursorLoader;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.provider.DocumentsContract;
import android.provider.MediaStore;
@samkirton
samkirton / gist:0242ba81d7ca00b475b9
Last active November 14, 2022 13:31
Fixed a bug where images added to the MediaStore are not inserted at the front of the gallery
package com.memtrip;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.OutputStream;
import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.ContentValues;
import android.graphics.Bitmap;