Skip to content

Instantly share code, notes, and snippets.

Avatar
😎

Rafik Farhad RafikFarhad

😎
View GitHub Profile
@RafikFarhad
RafikFarhad / .bashrc
Last active Dec 26, 2021
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…
View .bashrc
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 Jul 24, 2021
This script gather all cron job from all possible location and output as list. Credit: https://stackoverflow.com/a/137173/6189461
View cron_finder.sh
#!/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
@RafikFarhad
RafikFarhad / ckeditor.js
Created Mar 3, 2021
Ckeditor-build-classic with @wiris/MathType
View ckeditor.js
/*!
* @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
View keybase.md

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:

View service_manager.sh
#!/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
View pull_in_server.sh
#!/bin/bash
# Author: Rafik Farhad
# 26-06-2019
# cat file.sh | SSHPASS=****** sshpass -e ssh root@host
echo -e "\e[32mLogged in to server\e[39m"
echo -e ""
echo -e "\e[32m--------------------------------------\e[39m"
echo -e "\e[32mBackend\e[39m"
@RafikFarhad
RafikFarhad / QueryPaginator.php
Last active Dec 4, 2019
Get Paginated info from any Eloquent ORM Query
View QueryPaginator.php
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();
View config.yml
swipe:
3:
left:
command: 'xdotool key alt+Tab'
right:
command: 'xdotool key alt+shift+Tab'
up:
command: 'xdotool key super'
down:
command: 'xdotool key super'
@RafikFarhad
RafikFarhad / kbd_light.sh
Last active Feb 26, 2019
# Asus Vivobook Keyboard Light
View kbd_light.sh
#!/bin/bash
brightness=$(cat "/sys/class/leds/asus::kbd_backlight/brightness")
# a=$((brightness-1))
if [ "$brightness" -gt 2 ]
then
a=0
echo $a >> /sys/class/leds/asus\:\:kbd_backlight/brightness
elif [ "$brightness" -gt 0 ]
then
a=$((brightness+1))
View agnosterzak-pro.zsh-themes
# vim:ft=zsh ts=2 sw=2 sts=2
#
# agnoster's Theme - https://gist.github.com/3712874
# A Powerline-inspired theme for ZSH
#
# # README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://gist.github.com/1595572).
#