Skip to content

Instantly share code, notes, and snippets.

View khairulhasanmd's full-sized avatar

Md. Khairul Hasan khairulhasanmd

View GitHub Profile
@khairulhasanmd
khairulhasanmd / gist:6fc7691db878d615d63dcbf00e0973c0
Created July 30, 2024 18:26 — forked from ibnux/gist:59dd7d64bd9cb7e1e670b6ddd70ad991
Mikrotik Script for DHCP Lease to Queue simple
:local queueName "Client-$leaseActMAC";
:local ipAdd "$leaseActIP/32";
:if ([:len [/queue simple find name=$queueName]] = 0) do={
:log info "No Queue";
/queue simple add name=$queueName target=($ipAdd) limit-at=10M/4M max-limit=10M/4M comment=[/ip dhcp-server lease get [find where active-mac-address=$leaseActMAC && active-address=$leaseActIP] host-name];
} else={
:log info "exists";
:local ada [/queue simple get [find name=$queueName] target];
nano ~/.bashrc
press ctrl+end and put there:
crwl() {
wget --tries=inf --timestamping --recursive --level=inf --convert-links --page-requisites --no-parent "$@"
}
ctrl+O
@khairulhasanmd
khairulhasanmd / query.sql
Created April 4, 2024 05:56
Mysql Get child table data as json in same row
SELECT a.id, a.product_name, a.pdf_url,
JSON_ARRAYAGG(
JSON_OBJECT(
'id', c.id,
'name', c.name
)
) AS tag
FROM products a
LEFT JOIN product_tags b ON (a.id = b.product_id)
LEFT JOIN tags c ON (b.tag_id = c.id)
@khairulhasanmd
khairulhasanmd / common.txt
Created December 8, 2021 08:03 — forked from saniyathossain/common.txt
Stacks, Coding Guidelines, Acronyms
STACKS:
Project management: Agile, Scrum, JIRA (tool)
Version Control: GIT, Github (Repo), Gitlab (Repo), Bitbucket (Repo), Azure (Repo)
Back-end: PHP (MVC (Model View Controller): Laravel, CakePHP, Symphony, Codeigniter, YII, micro-framework: Lumen, Slim), CMS (Content Management System): Wordpress, Prestashop, Joomla, Magento, Opencart
ORM (Object Relational Mapping): Eloquent (Built in with laravel framework), CakePHP ORM (Built in with CakePHP framework), RedBeanPHP
PHP modules: PHP FPM, PHP CLI
Unit Test: PHPUnit, Codeception, PEST (framework)
Async PHP: Swoole, ReactPHP, Laravel Octane
Cache: File, Memcache, Redis, Database
For a very fragile workaround, you can edit /usr/lib/python3/dist-packages/certbot_nginx/configurator.py and replace
return [challenges.HTTP01, challenges.TLSSNI01]
with
return [challenges.HTTP01]
(or you… can use the webroot plugin)

Using Git to Manage a Live Web Site

###Overview

As a freelancer, I build a lot of web sites. That's a lot of code changes to track. Thankfully, a Git-enabled workflow with proper branching makes short work of project tracking. I can easily see development features in branches as well as a snapshot of the sites' production code. A nice addition to that workflow is that ability to use Git to push updates to any of the various sites I work on while committing changes.

####Contents

@khairulhasanmd
khairulhasanmd / time-reqd.php
Last active July 13, 2017 06:26
php time required for a code run in seconds
<?php
$start = microtime(true);
//some code
$now = microtime(true);
echo $now - $start . '<br>';
$start = $now;
onchange="check_start_date(this)"
function check_start_date1(object) {
var name = 'input[name="' + object.name + '"]';
var objects = $(name);
var index = objects.index( object );
var leave_type_id = document.getElementsByName('leave_type_id[]');
var detail_start_date = document.getElementsByName('detail_start_date[]');
@khairulhasanmd
khairulhasanmd / jsidle.js
Created April 23, 2017 05:38
js idle detection
var timeout = null;
$(document).on('mousemove', function() {
if (timeout !== null) {
$(document.body).text('');
clearTimeout(timeout);
}
timeout = setTimeout(function() {
$(document.body).text('Mouse idle for 3 sec');
@khairulhasanmd
khairulhasanmd / controller and model functions list.php
Created April 22, 2017 06:11
controller and model functions list
<?php
public function test($value='')
{
echo '<h2>Controller</h2>'.$this->router->class.'<pre>';
$mthds = (get_class_methods ( $this->router->class ));
foreach ($mthds as $key => $value) {
echo $value.'<br>';
}
echo '</pre><h2>Model</h2>';
echo '<pre>'.$this->router->class.'_mdl';