Skip to content

Instantly share code, notes, and snippets.

View mishajib's full-sized avatar
👌
SOFTWARE ENGINEER

MI Shajib mishajib

👌
SOFTWARE ENGINEER
View GitHub Profile
@mishajib
mishajib / SummarizeController.php
Last active September 10, 2023 11:54
Chatgpt summarizer
<?php
namespace App\Http\Controllers;
use App\Models\RawEvent;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Http;
class SummarizeController extends Controller
{
@mishajib
mishajib / network_namesace_connect_by_bridge.sh
Created June 10, 2023 19:38
Connect network namespaces by bridge
#!/bin/bash
NS1="red"
NS2="blue"
VETH1="veth-red"
VETH1_BR="veth-red-br"
VETH2="veth-blue"
VETH2_BR="veth-blue-br"
VETH_BR="veth-br"
IP_ADDR1="10.0.0.1/24"
@mishajib
mishajib / window_changer.sh
Last active May 30, 2023 19:08
Window changer by xdotool in linux by bash scripts. Here automate the `alt + tab` command.
#!/bin/bash
while true; do
xdotool keydown alt key Tab; sleep 2; xdotool keyup alt
sleep 30;
done
# First need to make executable by Run this command.
# chmod +x file_name.sh
# And then run like this from folder -> ./file_name.sh
@mishajib
mishajib / packet_parser.py
Created May 4, 2023 22:19
Packet parser by Python.
#=================================
# Author: MI SHAJIB
#=================================
import struct
# Sample packet in hex format
packet = b'450000280000400080060000c0a80101c0a80164'
# Convert packet to binary format
@mishajib
mishajib / packet_parser.js
Created May 4, 2023 22:18
Packet parser by JavaScript
//=================================
//# Author: MI SHAJIB
//=================================
// Sample packet in hex format
const packet = "450000280000400080060000c0a80101c0a80164";
// Convert packet to binary format
const packetBinary = Buffer.from(packet, "hex");
@mishajib
mishajib / network_namespace.js
Created May 3, 2023 19:12
Create two network namespaces and connect them by veth cable.
//=================================
//# Author: MI SHAJIB
//=================================
// Import execSync for execute os command
const { execSync } = require("child_process");
// Init data
const NS1 = "red";
const NS2 = "blue";
@mishajib
mishajib / network_namespace.py
Created May 3, 2023 19:11
Create two network namespaces and connect them by veth cable.
#=================================
# Author: MI SHAJIB
#=================================
# Import necessary library for run command on OS(operating system)
import os
# Constants
NS1 = 'red'
NS2 = 'blue'
@mishajib
mishajib / ramandan_calendar_2023.json
Last active March 23, 2023 18:17
Ramadan calendar 2023
{
"calendars": [
{
"date": "2023-03-24",
"sehri_time": "04:39:00",
"iftar_time": "18:14:00"
},
{
"date": "2023-03-25",
"sehri_time": "04:38:00",
@mishajib
mishajib / github_actions_by_ssh.yml
Last active March 7, 2023 06:06
By this application can deploy using ssh
name: Deploy website on push in production server
on:
push:
branches:
- production
jobs:
build:
name: Build
runs-on: ubuntu-latest
@mishajib
mishajib / remove_email_and_phone_number_from_string.php
Last active August 29, 2022 18:00
This helper helps to remove email & phone number from string/text.
<?php
function removeEmailAndPhoneFromString($string) {
// remove email
$string = preg_replace('/([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)/', '*****', $string);
// remove phone
$string = preg_replace('/([0-9]+[\- ]?[0-9]+){4,}/', '*****', $string);
return $string;