Skip to content

Instantly share code, notes, and snippets.

User {#1511 ▼
+token: "173220e55d4756590dd330000009b2e2594bf"
+refreshToken: null
+expiresIn: null
+id: 19613660
+nickname: "khavari"
+name: "Mohammad Khavari"
+email: "khavari.mvc@gmail.com"
+avatar: "https://avatars2.githubusercontent.com/u/19613660?v=4"
+user: array:30 [▼

Single database backup

sudo mysqldump -u root -p database_name > /var/www/dump/file_name.sql

Multiple databases backup

sudo mysqldump -u root -p --all-databases > /var/www/dump/file_name.sql
@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: [
@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 / 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 / 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 / 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:

#!/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"

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