Skip to content

Instantly share code, notes, and snippets.

View trungpv1601's full-sized avatar
🤖
Diversifying; Practical; more code than talk.

trungpv trungpv1601

🤖
Diversifying; Practical; more code than talk.
View GitHub Profile
@makoto1984
makoto1984 / live-meta.sh
Last active January 15, 2021 15:57
streaming music with generated video to youtube via ffmpeg
#!/bin/sh
# This script is a companion of the script youtube-music-live.sh. Assuming the MUSIC_PATH is an icecast2 stream, The script will fetch the metadata tag StreamTitle every 5 seconds and update the file /tmp/artist, /tmp/title. Generally, the StreamTitle should be like "artist - title", though sometimes there is only title. You may also update the files manually and ignore this script. Be sure to run this script after youtube-music-live.sh.
# You have to define music url.
MUSIC_PATH=
while [ `pgrep -x ffmpeg` ]
do
meta=`ffprobe -v error -show_format "$MUSIC_PATH" | grep StreamTitle | cut -d= -f2`
case "$meta" in
@nemke82
nemke82 / async-reindex-m2-2.sh
Last active November 26, 2020 07:25
Script to speed up Magento 2 indexer execution
#!/bin/bash
#Author: Nemanja Djuric
#Script to speed up Magento 2 indexer execution. NOTE: Ajust PHP name, if necessarry.
#!/bin/bash
if [[ -e app/etc/env.php ]]; then
i=0
input=$(php bin/magento indexer:info | awk {'print $1'})
@santoshachari
santoshachari / Laravel PHP7 LEMP AWS.md
Last active February 20, 2024 10:00
Laravel 5.x on Ubuntu 16.x, PHP 7.x, Nginx 1.9.x

#Steps to install latest Laravel, LEMP on AWS Ubuntu 16.4 version. This tutorial is the improvised verision of this tutorial on Digitalocean based on my experience.

Install PHP 7 on Ubuntu

Run the following commands in sequence.

sudo apt-get install -y language-pack-en-base
sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install zip unzip
@bahmutov
bahmutov / README.md
Last active July 11, 2022 13:03
Trying Redis in Docker + as-a

Goal: try redis inside a Docker container

Run Redis Docker image

  1. Open docker terminal
  • displays docker is configured to use the default machine with IP 192.168.99.100
  1. Start redis:alpine prebuilt container from docker hub.
  • docker run --name redis -p 6379:6379 -d redis:alpine
  • the "alpine" image is very slim (5MB!)
  • the running container binds the internal port 6379 to the "outside" world port with same number
@fevangelou
fevangelou / my.cnf
Last active July 23, 2024 16:31
Optimized my.cnf configuration for MySQL/MariaDB (on Ubuntu, CentOS, Almalinux etc. servers)
# === Optimized my.cnf configuration for MySQL/MariaDB (on Ubuntu, CentOS, Almalinux etc. servers) ===
#
# by Fotis Evangelou, developer of Engintron (engintron.com)
#
# ~ Updated December 2021 ~
#
#
# The settings provided below are a starting point for a 8-16 GB RAM server with 4-8 CPU cores.
# If you have different resources available you should adjust accordingly to save CPU, RAM & disk I/O usage.
#
@oshliaer
oshliaer / 70e04a67f1f5fd96a708.md
Last active August 5, 2023 09:22
Extract Gmail content to a spreadsheet #gas #gmail #sheet
@joecampo
joecampo / Connecting PHP 5.6 to MSSQL.md
Last active June 4, 2022 14:20
Connecting PHP 5.6 to MSSQL - Ubuntu (Debian) w/ Apache
@staltz
staltz / introrx.md
Last active July 22, 2024 09:31
The introduction to Reactive Programming you've been missing
@tdebatty
tdebatty / delete_older_than.php
Last active July 19, 2024 07:42
A simple PHP function to delete files older than a given age. Very handy to rotate backup or log files, for example...
<?php
/**
* A simple function that uses mtime to delete files older than a given age (in seconds)
* Very handy to rotate backup or log files, for example...
*
* $dir String whhere the files are
* $max_age Int in seconds
* return String[] the list of deleted files
*/
@menzerath
menzerath / backup.php
Last active February 18, 2024 19:33
PHP: Recursively Backup Files & Folders to ZIP-File
<?php
/*
* PHP: Recursively Backup Files & Folders to ZIP-File
* MIT-License - 2012-2018 Marvin Menzerath
*/
// Make sure the script can handle large folders/files
ini_set('max_execution_time', 600);
ini_set('memory_limit', '1024M');