Skip to content

Instantly share code, notes, and snippets.

View RafikFarhad's full-sized avatar
😎

Rafik Farhad RafikFarhad

😎
View GitHub Profile
@RafikFarhad
RafikFarhad / lemp_setup.sh
Created April 28, 2018 20:54
LEMP Stack for Ubuntu 18.04
#!/bin/bash
GREEN='\033[0;32m'
CYAN='\033[0;36m'
NC='\033[0m'
echo "${CYAN}Welcome to Easy LEMP Stack Setup${NC}"
echo "${CYAN}Ubuntu 18.04 Supported${NC}"
echo "${GREEN}Created By SUST CSE Developer Network (SCDN)\n${NC}"
echo "${GREEN}Maintained By Rafik Farhad\n${NC}"
@RafikFarhad
RafikFarhad / ckeditor.js
Created March 3, 2021 10:20
Ckeditor-build-classic with @wiris/MathType
/*!
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md.
*/
/*eslint-disable*/!function(t){const e=t.en=t.en||{};e.dictionary=Object.assign(e.dictionary||{},{"%0 of %1":"%0 of %1","Align center":"Align center","Align left":"Align left","Align right":"Align right","Block quote":"Block quote",Bold:"Bold","Bulleted List":"Bulleted List",Cancel:"Cancel","Cannot upload file:":"Cannot upload file:","Centered image":"Centered image","Change image text alternative":"Change image text alternative","Choose heading":"Choose heading",Column:"Column","Could not insert image at the current position.":"Could not insert image at the current position.","Could not obtain resized image URL.":"Could not obtain resized image URL.","Decrease indent":"Decrease indent","Delete column":"Delete column","Delete row":"Delete row",Downloadable:"Downloadable","Dropdown toolbar":"Dropdown toolbar","Edit link":"Edit link","Editor toolbar":"Editor toolbar","Enter image cap
@RafikFarhad
RafikFarhad / .bashrc
Last active December 26, 2021 17:46
I'm used to tmux but my work environment needs x86 most of the time. So I have to use brew of my x86_64 terminal (Rosetta terminal). But when I do other experimental tasks in my native arm64 terminal, when using tmux I got x86_64 terminal inside tmux pane/window because I installed tmux using x86_64 brew. So I planned to use both flavour of brew…
source /Users/farhad/.my-dot-files/zshrc.conf
source /Users/farhad/.my-dot-files/legacy/.aliases
if [[ $(uname -m) == "x86_64" ]]; then
echo "x86_64 detected"
export PATH=/usr/local/Homebrew/bin:$PATH
else
echo "arm64 detected"
# the following line prioritize the arm brew's installation
export PATH=/opt/homebrew/bin:$PATH
@RafikFarhad
RafikFarhad / cron_finder.sh
Created July 24, 2021 15:34
This script gather all cron job from all possible location and output as list. Credit: https://stackoverflow.com/a/137173/6189461
#!/bin/bash
# System-wide crontab file and cron job directory. Change these for your system.
CRONTAB='/etc/crontab'
CRONDIR='/etc/cron.d'
# Single tab character. Annoyingly necessary.
tab=$(echo -en "\t")
# Given a stream of crontab lines, exclude non-cron job lines, replace

Keybase proof

I hereby claim:

  • I am RafikFarhad on github.
  • I am rafikfarhad (https://keybase.io/rafikfarhad) on keybase.
  • I have a public key whose fingerprint is 1319 308A DB38 EB53 DD47 77C6 2A02 B0B7 50CF 3BCB

To claim this, I am signing this object:

function dbash() {
( docker exec -it $* bash )
}
function dsh() {
( docker exec -it $* sh )
}
alias gss='git status'
alias ga='git add --all'
@RafikFarhad
RafikFarhad / QueryPaginator.php
Last active December 4, 2019 10:31
Get Paginated info from any Eloquent ORM Query
public function mergeQueryPaginate(\Illuminate\Database\Eloquent\Builder $query): \Illuminate\Pagination\LengthAwarePaginator
{
$raw_query = $query;
$totalCount = $raw_query->get()->count();
$page = request('page', 1);
$skip = $perPage * ($page - 1);
$raw_query = $raw_query->take($perPage)->skip($skip);
$parameters = request()->getQueryString();
#!/bin/bash
<<ReadMe
Author: Rafik Farhad <rafikfarhad@gmail.com>
Run: bash sudo <script.sh>
ReadMe
if [[ $(id -u) -ne 0 ]]; then
echo "Please run as root"
exit ;
fi
read -r -p 'Project Name: ' project_name
server {
listen 50;
listen localhost:50;
server_name _;
root /var/www/pmad;
index index.php index.html index.htm;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
#!/bin/bash
mode=$1
if [ "$mode" = "stop" ]
then
echo -e "Stopping Services..."
sudo service nginx stop
sudo service mysql stop
sudo service php7.3-fpm stop