Skip to content

Instantly share code, notes, and snippets.

View mainul35's full-sized avatar
🏠
Working from home

Syed Mainul Hasan mainul35

🏠
Working from home
  • BRED IT
  • Thailand
View GitHub Profile

FWIW: I didn't produce the content presented here (the outline from Edmond Lau's book). I've just copy-pasted it from somewhere over the Internet, but I cannot remember what exactly the original source is. I was also not able to find the author's name, so I cannot give him/her the proper credits.


Effective Engineer - Notes

What's an Effective Engineer?

@mainul35
mainul35 / invalidate-token.js
Last active July 31, 2023 06:29
Invalidate token on closing all browser tabs in a JavaScript application
function manageLoginSession() {
let totalTabs: number;
window.onload = function(e) {
let accessToken = sessionStorage.getItem("accessToken");
let refreshToken = sessionStorage.getItem("refreshToken");
let expiresAt = sessionStorage.getItem("expiresAt");
if (accessToken !== null && refreshToken !== null && expiresAt !== null) {
localStorage.setItem("accessToken", accessToken);
localStorage.setItem("refreshToken", refreshToken);
@mainul35
mainul35 / how-to-install-graalvm-linux.md
Created March 3, 2020 04:24 — forked from ricardozanini/how-to-install-graalvm-linux.md
How to install GraalVM on Linux with alternatives

How to Install GraalVM Community Edition on Linux

Note: Tested on Fedora only

  1. Download the new release of GraalVM and unpack it anywhere in your filesystem:
$ tar -xvzf graalvm-ce-1.0.0-rc14-linux-amd64.tar.gz
@mainul35
mainul35 / GraalVM-installation.md
Last active March 5, 2020 13:04
Demonstrating how to install GraalVM on Linux
  1. Download from the official site.

  2. Extract it.

    sudo tar -zxvf graalvm-ce-java11-linux-amd64-20.0.0.tar.gz

  3. Move it to /usr/lib/jvm/

    mv graalvm-ce-java11-20.0.0 /usr/lib/jvm/

  4. Check your java alternatives

sudo update-alternatives --config java

@mainul35
mainul35 / Postgres important commands.md
Last active September 12, 2020 06:54
Postgresql important commands for PSQL DB management and queries

Login to PostgreSQL from terminal with Postgres DB user

Note that, in following lines, you have first entered into postgres user't terminal (Of your OS) root Then by using psql command, you have entered into the postgres DB user's shell

[mainul35@localhost ~]$ sudo su postgres
bash-5.0$ psql
could not change directory to "/home/mainul35": Permission denied
psql (11.7)
Type "help" for help.
@mainul35
mainul35 / MySQL User Grant and Password Policy Reset.md
Last active January 23, 2021 07:54
MySQL User Grant and Password Policy Reset

Background story

It is a common scenario that we often forget out database password. When we try to log in to our mysql DB, we face the following error message. If we use a password:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

If we don't use a password:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
@mainul35
mainul35 / r2dbc postgresql connection with properties file.properties
Last active September 6, 2020 07:44
r2dbc postgresql connection with properties file
```
# Database connection url: r2dbc:postgresql://host/bd_name
spring.r2dbc.url=r2dbc:postgresql://localhost/r2dbc_test
# Connection username
spring.r2dbc.username=postgres
# Connection Password
spring.r2dbc.password=
```
@mainul35
mainul35 / r2dbc postgresql connection with configuration class.java
Created September 6, 2020 07:42
r2dbc postgresql connection with configuration class
@Configuration
@EnableR2dbcRepositories(basePackages = "com.mainul35.repositories")
public class DatabaseConfig extends AbstractR2dbcConfiguration {
@Value("${datasource.host}")
private String host;
@Value("${datasource.port}")
private int port;
@Value("${datasource.database}")
private String database;
@SpringBootApplication
public class ReactivespringApplication implements CommandLineRunner {
@Autowired
private DatabaseClient databaseClient;
@Autowired
private ReservationRepository reservationRepository;
public static void main(String[] args) {
SpringApplication.run(ReactivespringApplication.class, args);