Skip to content

Instantly share code, notes, and snippets.

Avatar
😎
Always compiling something awesome.

Rafik Farhad RafikFarhad

😎
Always compiling something awesome.
View GitHub Profile
View Keybase Proof
### Keybase proof
I hereby claim:
* I am rafikfarhad on github.
* I am rafikfarhad (https://keybase.io/rafikfarhad) on keybase.
* I have a public key ASB8taH3dog4N95a-ZsjxIdqUSG_eFbWsFsTKshyAmv4ogo
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).
#
View .bash_alias
function dbash() {
( docker exec -it $* bash )
}
function dsh() {
( docker exec -it $* sh )
}
alias gss='git status'
alias ga='git add --all'
@RafikFarhad
RafikFarhad / default.conf
Last active Feb 14, 2019
A default NGINX Configuration file with cache support.
View default.conf
server {
server_name _;
listen 80;
#charset koi8-r;
access_log /var/log/nginx/host.access.log main;
root /var/www/laravel/public;
View gist:38fffb59c3e7efd33d7e503b78f19e77
server {
listen 51;
root /usr/share/adminer;
# Logging
error_log /var/log/nginx/adminer.access_log;
access_log /var/log/nginx/adminer.error_log;
You can’t perform that action at this time.