Skip to content

Instantly share code, notes, and snippets.

Rajesh K. Chaudhary rajeshisnepali

  • Neputer Tech Pvt. Ltd.
  • Gwarko, Lalitpur, Nepal
Block or report user

Report or block rajeshisnepali

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rajeshisnepali
rajeshisnepali / website.conf
Last active Jun 14, 2019
Redirect URL to https:// with non-www.
View website.conf
# lets assume we've a domain 'mysite.com'
# i've generated ssl from certbot
# https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-18-04
server {
listen 80;
server_name mysite.com www.mysite.com;
return 301 https://mysite.com.com$request_uri;
}
server {
@rajeshisnepali
rajeshisnepali / Envoy.blade.php
Created Jun 12, 2019
Zero Downtime deploy project to server (production)
View Envoy.blade.php
@servers(['production' => 'ubuntu@X.X.X.X'])
@setup
$repo = 'git@gitlab.com:<username>/<project-name>.git';
date_default_timezone_set('Asia/Kathmandu');
$release = date('YmdHis');
$releases_dir = '/var/www/html/final/releases';
$app_dir = '/var/www/html/final';
$new_release_dir = $releases_dir .'/'. $release;
@rajeshisnepali
rajeshisnepali / setup-project.sh
Created Apr 5, 2019
setup a project (laravel or any php) making serverblock (nginx) after cloning from git.
View setup-project.sh
#!/bin/bash
# version 1.2
### changelog: first ask whether it's a laravel project or not.
# to be able to work this function globally, copy or create link in /usr/local/bin with execute permission (chmod +x)
## Process
# 1. cp .env.example .env
# 2. composer install
# 3. php artisan key:generate
@rajeshisnepali
rajeshisnepali / deploy-to-server.sh
Created Mar 9, 2019
automatically deploy to server with git
View deploy-to-server.sh
#!/bin/bash
# set up automatic deployment with git to VPS
# format :::: ./deploy-to-server.sh <project-name>
project=$1
server_www_dir=/var/www/html/$project
server_repo=/srv/git/$project.git
# create server_repo if not exists
@rajeshisnepali
rajeshisnepali / db-backup.sh
Last active Jun 17, 2019
mysql dump database with specific database [folder name].
View db-backup.sh
#!/bin/bash
# colors
GREEN='\033[0;32m'
NC='\033[0m' # No Color
# dbDump functions
dbDump() {
# backup location
LOCATION=~/dumps/
@rajeshisnepali
rajeshisnepali / project-create.sh
Last active Feb 28, 2019 — forked from francoisromain/project-create.sh
A bash script to create a Git post-receive hook to deploy after a Git push
View project-create.sh
#!/bin/bash
# Call this file with `bash ./project-create.sh project-name [service-name]`
# - project-name is mandatory
# - service-name is optional
# This will creates 4 directories and a git `post-receive` hook.
# The 4 directories are:
# - $GIT: a git repo
# - $TMP: a temporary directory for deployment
@rajeshisnepali
rajeshisnepali / install-oh-my-zsh.sh
Last active Jun 19, 2019
install oh-my-zsh including `zsh-autosuggestions`
View install-oh-my-zsh.sh
#!/bin/bash
# colors
YELLOW='\e[43m'
LRED='\e[101m'
NC='\033[0m' # No Color
getOSArchitecture() {
arch=$(awk -F= '/^ID_LIKE/{print $2}' /etc/os-release)
if [ "$arch" = "debian" ];
@rajeshisnepali
rajeshisnepali / drop-db.sh
Created Feb 27, 2019
drop database in mysql
View drop-db.sh
#!/bin/bash
#format
# drop-db.sh '`test-1234`'
mysql -u root -p <<MYSQL_SCRIPT
DROP DATABASE $1;
MYSQL_SCRIPT
echo Mysql Database $1 dropped
@rajeshisnepali
rajeshisnepali / synclient.sh
Created Feb 6, 2019
disable keyboard while typing (synclient)
View synclient.sh
#!/bin/bash
# synclient
# Disable touchpad while typing
synclient PalmDetect=1
synclient PalmMinWidth=8
synclient PalmMinZ=100
@rajeshisnepali
rajeshisnepali / laravel-permissions.sh
Created Feb 6, 2019
Give permission and change ownership to run Laravel application
View laravel-permissions.sh
#!/bin/bash
# to be able to work this function globally, copy or create link in /usr/local/bin
# Change ownership for .env
sudo chown $USER:$USER .env
# Give write Permission to /bootstrap/cache & /storage
sudo chown -R $USER:www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache
You can’t perform that action at this time.