Skip to content

Instantly share code, notes, and snippets.

View abidkhan484's full-sized avatar
🎯
Focusing

AbId KhAn abidkhan484

🎯
Focusing
View GitHub Profile
@abidkhan484
abidkhan484 / README.md
Last active October 24, 2024 09:46
Concept of Rabin Karp Algorithm

Drawback: Spurious Hits

@abidkhan484
abidkhan484 / cluster_lock.js
Created July 2, 2024 05:49
Fringcore cluster lock challenge
import { send, doWork } from "./lib.mjs";
import cluster from "node:cluster";
const NAME = process.env.NAME;
export async function onMessage(message) {
if (cluster.worker.message !== message) {
cluster.worker.message = message;
} else {
return;
@abidkhan484
abidkhan484 / openssl.php
Created June 13, 2024 04:00
OpenSSL encryption example with AES-256-CBC
<?php
$privateKey = 'someprivatekey';
$secretInfo = 'secretInfo';
$method = 'aes-256-cbc';
$ivLength = openssl_cipher_iv_length($method);
$iv = random_bytes($ivLength);
$encryptedData = openssl_encrypt($secretInfo, $method, $privateKey, OPENSSL_RAW_DATA, $iv);
@abidkhan484
abidkhan484 / log_parser.py
Created May 23, 2024 04:24
Log parser of specific file pattern where the response time is at the end of the csv file
import os
import csv
import sys
import argparse
import datetime
parser=argparse.ArgumentParser(
description='''By default it will parse the today's logs'''
)
parser.add_argument('-d', type=int, default=1, help='set the number of days you would like to parse the logs. dafault 1 day.')
@abidkhan484
abidkhan484 / php-xdebug-docker.md
Created May 6, 2024 09:10
php xdebug with docker

docker-php-ext-xdebug.ini

zend_extension=xdebug.so
xdebug.cli_color=1
xdebug.show_local_vars=1
xdebug.idekey=VSCODE
xdebug.max_nesting_level=300
xdebug.remote_enable=1
xdebug.remote_autostart=1
xdebug.remote_connect_back=0
@abidkhan484
abidkhan484 / sync_config_drupal.md
Last active January 11, 2024 06:08
Sync Configuration Drupal 9 using commandline

Sync Configuration Drupal 9 using commandline

A short handnote to sync configuration between different environments like local, dev, staging or production using Drupal and Drush commands.

Export configuration

To export using drupal command

./vendor/bin/drupal config:export:entity \
@abidkhan484
abidkhan484 / git-management.md
Created January 11, 2024 03:59
Manage two different Git servers

Manage two different Git servers

There is a need to manage multiple Git servers for the development and deployment.

Repository Clone

@abidkhan484
abidkhan484 / prime_check_multi_threaded.py
Last active December 17, 2023 16:39
Prime check using multi thread
#! /usr/bin/python3
import concurrent.futures
from math import floor, sqrt
import time
def is_prime(number: int) -> bool:
if not (number & 1): return 0
iteration = floor(sqrt(number)) + 1
@abidkhan484
abidkhan484 / prime_check_multi_process.py
Last active December 18, 2023 10:09
Prime check using multithreaded
#! /usr/bin/python3
import concurrent.futures
from math import floor, sqrt
import time
def is_prime(number: int) -> bool:
if not (number & 1): return 0
iteration = floor(sqrt(number)) + 1
@abidkhan484
abidkhan484 / prime_check_single_threaded.py
Last active December 18, 2023 10:06
Prime check using single threaded
#! /usr/bin/python3
from math import floor, sqrt
import time
def is_prime(number: int) -> bool:
if not (number & 1): return 0
iteration = floor(sqrt(number)) + 1
for i in range(3, iteration, 2):