Skip to content

Instantly share code, notes, and snippets.

View Roaim's full-sized avatar

Roaim Ahmed Hridoy Roaim

  • Dhaka, Bangladesh.
View GitHub Profile
@Roaim
Roaim / Contact.kt
Created October 11, 2020 16:31
Contacts Fetching Android
package app.roaim.contactsample.model
data class Contact(
val id: String,
val name: String? = null,
val number: String? = null,
val thumbUrl: String? = null
)
@Roaim
Roaim / CoroutinesLibraryLeak
Last active October 4, 2020 20:53
Corutines viewModelScope leaked in onCleared()
2020-10-05 02:45:32.595 11082-11305/app.roaim.password.vault D/LeakCanary: ====================================
HEAP ANALYSIS RESULT
====================================
1 APPLICATION LEAKS
References underlined with "~~~" are likely causes.
Learn more at https://squ.re/leaks.
1314 bytes retained by leaking objects
Signature: 70e4d657ab9eafddfe6d75395e1f6e684453f8
@Roaim
Roaim / ec2-user-data.txt
Last active September 1, 2020 22:30
AWS EC2 - Update DNS dynamically
Content-Type: multipart/mixed; boundary="//"
MIME-Version: 1.0
--//
Content-Type: text/cloud-config; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="cloud-config.txt"
#cloud-config

In language change Activity

LocaleHelper.setLocale(LanguageActivity.this, "bn");
restartApp();
            
private void restartApp() {
    Intent intent = new Intent(this, MainActivity.class);
    intent.putExtra("lang", true);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);

intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

@Roaim
Roaim / ImgToPdf.js
Created May 21, 2020 12:34
Js Image to PDF Downloader
let jspdf = document.createElement("script");
jspdf.onload = function () {
let pdf = new jsPDF('p', 'in', [648, 2664]);
let elements = document.getElementsByTagName("img");
for (let i in elements) {
let img = elements[i];
console.log("add img ", img);
if (!/^blob:/.test(img.src)) {
console.log("invalid src");
continue;
@Roaim
Roaim / DTBazar
Created May 20, 2020 05:53
Fb test users
amcafywrwj_1589952535@tfbnw.net
@Roaim
Roaim / spring-boot-auto-deploy.sh
Last active May 31, 2020 23:15
Spring boot auto deploy script
#! /bin/bash
if [ $# -lt 3 ];
then
echo "Please provide the project name, branch name and git user name"
else
projectName=$1
projectParentDir=/opt/$projectName
branchName=$2
gitUser=$3
@Roaim
Roaim / git-bare.sh
Last active March 19, 2020 21:12
Bash script to create a git bare repository with post-receive hook
#! /bin/bash
if [ $# -lt 3 ];
then
echo "Please provide the project name, project parent directory and branch name"
else
projectName="$1"
projectParentDir="$2"
branchName="$3"
gitDir="$PWD"
@Roaim
Roaim / WSL-Auto-Start-SSHD.md
Created February 17, 2020 22:56
Windows Subsystem Linux sshd service auto start

On the WSL put to the end of the /etc/sudoers file the following line:

%sudo ALL=NOPASSWD: /etc/init.d/ssh start

Put to the shell:Startup folder bat file with the content:

powershell.exe "& 'C:\Windows\System32\bash.exe' -c 'sudo /etc/init.d/ssh start'"

That's it!

no sudo promt no Task Scheduler stuff

@Roaim
Roaim / 1. Git bare repo (Server).md
Last active March 17, 2020 12:11
Node JS getting started

Add Git User

sudo adduser git sudo
    # or, if already exists but needs to make is sudo user
sudo usermod -aG sudo git
    # add the git to project's user's group
sudo usermod -aG {USER_NAME} git
    # To check
id git