Skip to content

Instantly share code, notes, and snippets.

View MrWeb's full-sized avatar

Andrea Lombardi MrWeb

View GitHub Profile
@MrWeb
MrWeb / ExtractCaptionsFromYoutube.php
Created March 21, 2024 19:05
Extract text and captions from a Youtube Video with PHP and Laravel
<?php
use Illuminate\Support\Facades\Http;
$videoId = "AuEv942wOZs";
$transcriptUrl = Http::post(
"https://youtubei.googleapis.com/youtubei/v1/player",
[
"videoId" => $videoId,
@MrWeb
MrWeb / web.php
Last active October 22, 2020 17:38
Autodeploy Laravel
Route::post('/git-auto-deploy/unique-key', function () {
$composer_dir = '/opt/cpanel/composer/bin';
//
exec('printf "[Deploy Start]: $(date "+%Y-%m-%d %H:%M:%S")" >> ../deploy.log');
exec("printf '\n' >> ../deploy.log");
exec("git pull origin master &>>../deploy.log");
exec('printf "[Deploy End]: $(date "+%Y-%m-%d %H:%M:%S")" >> ../deploy.log');
exec("printf '\n' >> ../deploy.log");
//
@MrWeb
MrWeb / FTP.php
Created October 12, 2020 10:19
Dynamic FTP Laravel Filesystem
$filesystem = new Filesystem(new Adapter([
'host' => $this->portal_db_data->ftp_server,
'username' => $this->portal_db_data->ftp_user,
'password' => $this->portal_db_data->ftp_pass,
/** optional config settings */
'port' => 21,
'root' => $this->ftp_file_path,
'passive' => true,
'ssl' => true,
@MrWeb
MrWeb / upload.php
Last active March 26, 2020 12:01
Upload immagine
<?php
use App\Image as ImageModel;
use Intervention\Image\ImageManagerStatic as Image;
public function upload(Request $request)
{
//Verifico Immagine
Validator::make(request()->all(), [
'file' => 'image|mimes:jpeg,png,jpg,gif,svg|max:5120',
])->validate();
@MrWeb
MrWeb / nonaggregated.sh
Created October 13, 2019 07:20
Fix nonaggregated MySQL GROUP BY local machine
mysql -uroot -e "SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));"
@MrWeb
MrWeb / tmux-cheatsheet.markdown
Created October 12, 2018 09:43 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname