Skip to content

Instantly share code, notes, and snippets.

View nowshad-hasan's full-sized avatar
🎯
Focusing

Nowshad Hasan nowshad-hasan

🎯
Focusing
View GitHub Profile
First of all, set up a server like Tomcat or Glassfish. Then install it seeing from any popular website like #Digital_Ocean or #ID_Root.net
Here is an example-
wget http://download.java.net/glassfish/4.1.1/release/glassfish-4.1.1.zip
unzip glassfish-4.1.1.zip
glassfish4/bin/asadmin start-domain
But we can start the server another way like glassfish4/bin/.asadmin start-domain.
And stop the server with glassfish4/bin/.asadmin stop-domain.
We can see the running project with glassfish4/bin/.asadmin list-applications
@nowshad-hasan
nowshad-hasan / flush-dns.sh
Created February 11, 2018 20:23 — forked from craigvantonder/flush-dns.sh
Flushing the DNS in Ubuntu 16.04
#!/bin/bash
# NB: First install nscd with sudo apt-get install nscd
# run this command to flush dns cache:
sudo /etc/init.d/dns-clean restart
# or use:
sudo /etc/init.d/networking force-reload
# Flush nscd dns cache:
sudo /etc/init.d/nscd restart
@nowshad-hasan
nowshad-hasan / gist:f13bb3739798fbee772fca965bf73839
Created April 3, 2018 05:03
copy file from one pc to another
scp /home/Desktop/my.cnf user@remotemachine:/app/MySQL/my.cnf use this
or you can navigate to the project folder of your pc and type scp /file_name root@remote_machine_ip:/root
(/root or any folder you want to navigate)
@nowshad-hasan
nowshad-hasan / README-Template.md
Created May 18, 2018 22:17 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@nowshad-hasan
nowshad-hasan / access to remote database.txt
Created May 20, 2018 06:40
This gist is for accessing remote database from your local machine
If a database like MySQL is on remote PC like Digital Ocean or another, then it will not allow you to connect from your home PC.
So, you need to get permission from the remote PC. For that, first type "nano /etc/mysql/my.cnf". If you are in Ubuntu 16.04,
then type nano /etc/mysql/mysql.conf.d/mysqld.cnf. There you will find blind address which is set to 127.0.0.1 by default.
Set it with '0.0.0.0'. Then restart your mysql server typing "sudo service mysql restart".
After that, log in into your mysql typing "server mysql -u root -p" and give the mysql password if need to.
Then type "GRANT ALL PRIVILEGES ON *.* TO 'mysql-user-name'@'ip-address' IDENTIFIED BY 'mysql-password' WITH GRANT OPTION;"
( Don't forget to give ';' at last. Otherwise it will not work.). If you want to get access for only one ip address then,
replace 'ip-address' part with that like '115.127.96.190'. But if you want to get all ip-address in the world get access to your database, then
replace 'ip-address' part with '%'. % is a wildcard - yo
@nowshad-hasan
nowshad-hasan / linebreak.md
Created May 23, 2018 03:46
Line breaks in markdown
Hello  (<-- two spaces)
World

Hello
World


@nowshad-hasan
nowshad-hasan / strings.xml
Last active January 20, 2019 04:32
XML to XLSX Converter Script
Here is the demo file of strings.xml.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">NKG Brazil</string>
<!-- Nav Drawer Menu Items -->
<string-array name="nav_drawer_items">
<item>Farmer</item>
<item>Training</item>
<item>Support requests</item>
@nowshad-hasan
nowshad-hasan / gist:615d645f7183a93aa0c2514448b2d5b3
Last active July 1, 2019 09:21
How to generate test apk for Firebase Test Lab?
You need to give two apks for testing on Firebase Test Lab. One is - 'main apk', another is 'test apk'. You can generate it easily but there are some other things you need to know. You can run the inidividual test file but can't make individual test apk for individual test files. All the test files under 'androidTest' folder make just one test apk. So, you need to remove all test files that you think, will fail before making 'test apk'. Then if you're sure about all the test files on the androidTest folder will pass, then you should check it on your local machine to test like on Test lab. Uninstall the older apk from your phone because on Test Lab, apk will be installed newly every time we run on that. Right click on 'androidTest' folder, then click on 'Run tests in ....'. It will run all the tests this folder has, thoroughly like Test lab. If it is passed, then you can prepare the apks for Test Lab. Here is the interesting part. For every test file you run (individual or folder selection), test apk is always
// Construct a request for phone numbers and show the picker
private void requestHint() {
HintRequest hintRequest = new HintRequest.Builder()
.setPhoneNumberIdentifierSupported(true)
.build();
GoogleApiClient apiClient= new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this) // implement the callbacks
.enableAutoManage(this, this)
.addApi(Auth.CREDENTIALS_API)
.build();
private void requestHint() {
HintRequest hintRequest = new HintRequest.Builder()
.setPhoneNumberIdentifierSupported(true)
.build();
PendingIntent intent = Credentials.getClient(this).getHintPickerIntent(hintRequest);
try {
startIntentSenderForResult(intent.getIntentSender(),