Skip to content

Instantly share code, notes, and snippets.

Deploy Next.js app on Ubuntu

1- Server Initial Setup

set server timezone to Asia/Tehran:

dpkg-reconfigure tzdata

update server:

Update Composer to the latest version

sudo composer self-update

Install Composer package

Change default openvpn account password

cd /usr/local/openvpn_as/scripts

./sacli --user "openvpn" --key "prop_superuser" --value "true" UserPropPut
./sacli --user "openvpn" --key "user_auth_type" --value "local" UserPropPut
#!/bin/bash
### Destination folder where backups are stored.
destination_root_path=/var/www/mysql_dump
date_dir=$(date +"%Y-%m-%d")
destination_dir=$destination_root_path/$date_dir
current_date=$(date +"%F")
### MySQL Configuration
db_host="localhost"
@khavari
khavari / ffmpeg_commands.md
Last active April 27, 2022 17:51
FFmpeg Commands

Useful FFmpeg Commands

Install FFmpeg:

sudo apt update
sudo apt install ffmpeg
ffmpeg -version

Get Video File Information:

@khavari
khavari / post_to_slack_using_webhook.md
Last active July 7, 2020 13:06
Post to Slack using Webhook

Send a message to slack using webhook via curl:

curl -X POST -H 'Content-type: application/json' --data '{"text":"Text message"}' YOUR_WEBHOOK_URL

Send a message to slack using webhook via javascript:

var xmlHttp = new XMLHttpRequest();
@khavari
khavari / initialize map with draggable marker
Created February 19, 2019 10:30
initialize map with draggable marker
<script>
let map;
function initialize () {
const lat = 35.731671;
const lng = 51.380317;
const zoom = 17;
map = new google.maps.Map(document.getElementById('google_map'), {
center: {lat: lat, lng: lng},
zoom: zoom,
mapTypeControl: false
@khavari
khavari / laravel_production_ubuntu.md
Last active June 15, 2024 09:54
Laravel Production Deployment

Laravel Production Ubuntu 20.04

1- Server Initial Setup

Set server timezone to Tehran:

dpkg-reconfigure tzdata

Upgrade server:

@khavari
khavari / gist:38d7cd4fa7c247c30f8f64023c4949ac
Created January 6, 2019 11:20
laravel-mix image minifier
npm install --save-dev imagemin-webpack-plugin copy-webpack-plugin imagemin-mozjpeg
const { mix } = require('laravel-mix');
const ImageminPlugin = require('imagemin-webpack-plugin').default;
const CopyWebpackPlugin = require('copy-webpack-plugin');
const imageminMozjpeg = require('imagemin-mozjpeg');
mix.webpackConfig({
plugins: [