Skip to content

Instantly share code, notes, and snippets.

View ImaginativeShohag's full-sized avatar
🍟
Already hungry...

Md. Mahmudul Hasan Shohag ImaginativeShohag

🍟
Already hungry...
View GitHub Profile
@ImaginativeShohag
ImaginativeShohag / android_libraries_and_tools.md
Last active February 11, 2026 08:38
Android Libraries & Tools
@ImaginativeShohag
ImaginativeShohag / ExtMoshi.kt
Last active May 6, 2025 12:38
Extension functions to convert object to json and json to object using Moshi. It also works with List, ArrayList, Collection etc.
object MoshiUtil {
fun getMoshi(): Moshi {
return Moshi.Builder()
.add(MutableCollectionJsonAdapter.FACTORY)
.build()
}
}
inline fun <reified T> String?.getObjFromJson(): T? {
if (this == null) return null
@ImaginativeShohag
ImaginativeShohag / how_to_connect_with_softether_vpn_client_in_linux.md
Last active February 17, 2025 12:47
How to connect with softether vpn client in linux
# ----------------------------------------------------------------
# Start and create vpn connection
# ----------------------------------------------------------------

# Download from https://www.softether-download.com/en.aspx?product=softether
# Select Software: SoftEther VPN (Freeware)
# Select Component: SoftEther VPN Client
# Select Platform: Linux
# Select CPU: Intel x64/AMD64 (64bit)
@ImaginativeShohag
ImaginativeShohag / How to Create and Use a VeraCrypt Container.md
Last active December 29, 2024 12:34
How to Create and Use a VeraCrypt Container

Create a VeraCrypt container

Step 1: Install VeraCrypt from https://www.veracrypt.fr

Step 2: Open VeraCrypt and Click Create Volume

Step 3: Selete what type of container you want to create

Encrypted file container

To create a file as a encrypted container select Create an encrypted file container.

@ImaginativeShohag
ImaginativeShohag / ubuntu_change_resolution.sh
Created July 13, 2019 03:49
Ubuntu: Change monitor resolution of Unknown Display
#!/bin/bash
xrandr --newmode $(cvt 1920 1080 60 | grep Mode | sed -e 's/.*"/1920x1080/') 2> /dev/null
xrandr --addmode VGA-1 1920x1080
xrandr --output VGA-1 --mode 1920x1080
@ImaginativeShohag
ImaginativeShohag / diff_of_run_let_also_apply.kt
Last active July 1, 2024 18:51
Difference between with, run, let, also and apply in Kotlin.
/**
* Difference between with, run, let, also and apply in Kotlin.
*
* Official doc: https://kotlinlang.org/docs/scope-functions.html#functions
*
* Awesome blog posts:
* - https://www.journaldev.com/19467/kotlin-let-run-also-apply-with
* - https://medium.com/@fatihcoskun/kotlin-scoping-functions-apply-vs-with-let-also-run-816e4efb75f5
* - https://medium.com/@elye.project/mastering-kotlin-standard-functions-run-with-let-also-and-apply-9cd334b0ef84
*/
@ImaginativeShohag
ImaginativeShohag / ExtNavController.kt
Last active June 23, 2024 14:41
"MainActivity.kt" example indicates that calling `navigateUp()` multiple times will recreate the `Activity`. To solve the black issue 2 extension function given in "ExtNavController.kt" file.
import android.app.Activity
import android.content.Context
import androidx.lifecycle.Lifecycle
import androidx.navigation.NavController
/**
* Attempts to pop the controller's back stack.
* If the back stack is empty, it will finish the activity.
*
* @param context Activity context.
@ImaginativeShohag
ImaginativeShohag / comment_mark_warning_error_example.swift
Last active June 12, 2024 10:14
Example of Swift comments (eg., `MARK`, `TODO`, `FIXME`), `#warning` macro and `#error` macro
// MARK: Feature One (No divider)
class FeatureOne {}
// MARK: - Class Two start (Top divider)
class FeatureTwo {}
// MARK: Class Two end - (Bottom divider)
@ImaginativeShohag
ImaginativeShohag / HomeIndexScreen.kt
Created December 25, 2023 10:18
Temp file (Delete later)
@Composable
fun HomeIndexScreen(
viewModel: HomeIndexViewModel,
goToBookDetailsScreen: (bookId: Long) -> Unit,
goToNoteDetailsScreen: (noteId: Long) -> Unit,
goToAddNewReadingScreen: () -> Unit,
goToAddNewBookScreen: () -> Unit,
goToAuthorsScreen: () -> Unit,
goToPublishersScreen: () -> Unit,
goToLendAddScreen: () -> Unit,
@ImaginativeShohag
ImaginativeShohag / install_latest_phpmyadmin.sh
Last active December 24, 2023 05:26
Install latest version of phpMyAdmin to Ubuntu.
#!/bin/sh
# ----------------------------------------------------------------
# This script will fetch the latest version from the phpMyAdmin
# website and do all the basic configurations for you.
# Enjoy.
#
# Copyright (c) 2021 Md. Mahmudul Hasan Shohag (imaginativeworld.org)
# This free software comes with ABSOLUTELY NO WARRANTY and
# is distributed under GNU GPL v3 license.