Skip to content

Instantly share code, notes, and snippets.

View msonowal's full-sized avatar
I zapp it.

Manash Sonowal msonowal

I zapp it.
View GitHub Profile
@msonowal
msonowal / ci.yml
Created February 8, 2024 19:33 — forked from nasrulhazim/ci.yml
GitHub Action - MySQL Service for Laravel with Multiple Databases
name: Unit Test
on:
push:
branches: [develop]
pull_request:
branches: [master, develop]
jobs:
PHPUnit:
@msonowal
msonowal / backup-mysql.yml
Last active February 8, 2024 19:33 — forked from salomvary/backup-mysql.yml
GitHub Action for mysqldump
name: backup-mysql
on:
schedule:
# Run at 7:00 UTC every day
- cron: "0 7 * * *"
jobs:
run_mysqldump:
runs-on: ubuntu-latest
steps:
- name: Dump database
# Let us consider the following typical mysql backup script:
mysqldump --routines --no-data -h $mysqlHost -P $mysqlPort -u $mysqlUser -p$mysqlPassword $database
# It succeeds but stderr will get:
# Warning: Using a password on the command line interface can be insecure.
# You can fix this with the below hack:
credentialsFile=/mysql-credentials.cnf
echo "[client]" > $credentialsFile
echo "user=$mysqlUser" >> $credentialsFile
echo "password=$mysqlPassword" >> $credentialsFile
@msonowal
msonowal / _HowToSetupAWSWAFv2.md
Created December 5, 2023 16:54 — forked from masayoshi644/_HowToSetupAWSWAFv2.md
How to setup AWS WAFv2
@msonowal
msonowal / work-with-multiple-github-accounts.md
Created March 28, 2023 18:41 — forked from rahularity/work-with-multiple-github-accounts.md
How To Work With Multiple Github Accounts on your PC

How To Work With Multiple Github Accounts on a single Machine

Let suppose I have two github accounts, https://github.com/rahul-office and https://github.com/rahul-personal. Now i want to setup my mac to easily talk to both the github accounts.

NOTE: This logic can be extended to more than two accounts also. :)

The setup can be done in 5 easy steps:

Steps:

  • Step 1 : Create SSH keys for all accounts
  • Step 2 : Add SSH keys to SSH Agent
@msonowal
msonowal / scroll.html
Created July 28, 2022 16:20 — forked from simonewebdesign/scroll.html
Scrolling feature for a web chat, without using libraries.It behaves like Skype: if the user is way too far from the bottom, it just doesn't scroll, because the user may be reading old posts.On the other hand, it will automatically scroll to the bottom on a "new message" event (in this demo, on button's click event).
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<style>
.content {
function getHighestConsecutiveRepeatedNumber(string $numberOrString) {
if (strlen($numberOrString) == 0) {
echo 'Please provide a valid value';
return;
}
$resultSet = [];
$previousResult = ['value' => null,];
@msonowal
msonowal / your-domain.com
Created April 11, 2022 13:32 — forked from lukaszflorczak/your-domain.com
Nginx configuration for Nuxt.js
server {
listen 80;
listen [::]:80;
index index.html;
server_name your-domain.com;
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
@msonowal
msonowal / abstract-unique-validator.ts
Created March 24, 2022 12:30 — forked from zarv1k/abstract-unique-validator.ts
Unique Validator Example for NestJS
import { ValidationArguments, ValidatorConstraintInterface } from 'class-validator';
import { Connection, EntitySchema, FindConditions, ObjectType } from 'typeorm';
interface UniqueValidationArguments<E> extends ValidationArguments {
constraints: [
ObjectType<E> | EntitySchema<E> | string,
((validationArguments: ValidationArguments) => FindConditions<E>) | keyof E,
];
}
@msonowal
msonowal / auth.js
Created March 15, 2022 18:02 — forked from wobsoriano/auth.js
nuxtServerInit like implementation for Pinia
import { defineStore } from 'pinia'
export const useAuthStore = defineStore({
id: 'auth',
state: () => ({
isAuthenticated: false,
user: null
}),
actions: {
async nuxtServerInit() {