Skip to content

Instantly share code, notes, and snippets.

View mjm918's full-sized avatar
🍻
Code & Chill

Mohammad Julfikar mjm918

🍻
Code & Chill
View GitHub Profile
@mjm918
mjm918 / client.py
Last active May 6, 2024 11:55
Python Encryption Decryption (Socket Chat,RSA Encryption/Decryption,AES.MODE_CTR encryption.IDEA.MODE_CTR Encryption/Decryption)
import time
import socket
import threading
import hashlib
import itertools
import sys
from Crypto import Random
from Crypto.PublicKey import RSA
from CryptoPlus.Cipher import IDEA
@mjm918
mjm918 / ServerReachable.js
Last active March 11, 2024 02:19
React Native check if server is reachable. Sometimes the device shows that you are connected to internet but when you make a request to your server, you dont get any response. This handy code will ping a server and wait for response, if no response, it will alert the user. You can use this code on top of your fetch function. It will run in paral…
export const isReachable = async () =>{
const timeout = new Promise((resolve, reject) => {
setTimeout(reject, 5000, 'Request timed out');
});
const request = fetch('https://xxxxxx.com');
try {
const response = await Promise
.race([timeout, request]);
return true;
}
@mjm918
mjm918 / SpeedTest.js
Created July 16, 2019 12:36
React native check internet speed
export const fetchParallel = (link,header, callback) =>{
const POOR = 150;
const MODERATE = 550;
const GOOD = 2000;
const _start = new Date().getTime();
const speedTester = RNFetchBlob
.config({
@mjm918
mjm918 / PDFGenManager.java
Created July 4, 2022 07:47
Oppo/Vivo Android WebView font bug fixed react-native-html-to-pdf
public class PDFGenManager extends ReactContextBaseJavaModule {
private static final String TAG = "PDFGenManager";
private ReactApplicationContext context;
private File directory;
private String dirPath;
private PDFConverter convertor;
public PDFGenManager(@NonNull ReactApplicationContext reactContext) {
super(reactContext);
this.context = reactContext;
@mjm918
mjm918 / Android-ImageColorsModule.java
Created July 4, 2022 07:40
React-Native Image Swatches / Color
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.util.Base64;
import androidx.annotation.NonNull;
import androidx.palette.graphics.Palette;
import com.bumptech.glide.Glide;
@mjm918
mjm918 / client.py
Created December 15, 2018 09:56
Python socket programming AES CBC encryption
import socket
import os
import threading
import hashlib
from Crypto import Random
import Crypto.Cipher.AES as AES
from Crypto.PublicKey import RSA
import signal
from lazyme.string import color_print
@mjm918
mjm918 / class.CreateReadUpdate.php
Last active April 3, 2020 11:49
PHP MySQL Object Oriented Programming
<?php
require_once(dirname(__FILE__).'/class.MySQL.php');
class CreateReadUpdate extends MySQL{
public function __construct(){
parent::__construct();
}
@mjm918
mjm918 / Banner.h
Last active September 11, 2019 13:19
React Native Banner View (Android & iOS native module)
//
// Banner.h
//
// Created by Mohammad Julfikar on 08/09/2019.
// Copyright © 2019 Facebook. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@mjm918
mjm918 / CreateImage.java
Created September 11, 2019 02:37
React Native Android watermark
public class CreateImage extends ReactContextBaseJavaModule {
private String finalPath = "";
private ReactApplicationContext reactApplicationContext = null;
public CreateImage(ReactApplicationContext reactContext) {
super(reactContext);
this.reactApplicationContext = reactContext;
}
@mjm918
mjm918 / CreateImage.h
Created September 11, 2019 02:35
React Native iOS Watermark
//
// CreateImage.h
// Created by Mohammad Julfikar on 28/06/2019.
// Copyright © 2019 Facebook. All rights reserved.
//
#import "RCTBridgeModule.h"
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>