Skip to content

Instantly share code, notes, and snippets.

View dinhngocvuong's full-sized avatar

Vuong Dinh dinhngocvuong

View GitHub Profile
@dinhngocvuong
dinhngocvuong / .bashrc
Created October 20, 2018 18:12 — forked from wzup/.bashrc
alias for Git Bash on Windows
# create a file C:\Users\[user]\.bashrc
# add this content
# add your onw aliases or changes these ones as you like
# to make a dot (.bashrs) file in windows, create a file ".bashrs." (without extention) and save. windows will save it as ".bashrc"
alias ls='ls -alh'
alias cdnginx='cd /c/nginx && ls'
alias cdmcga='cd /c/Users/[user]/sbox/node/mcga && ls'
alias cdfood9='cd /c/Users/[user]/sbox/node/food9 && ls'
alias cdmysql='cd /c/nginx/mysql/bin && ls'
@dinhngocvuong
dinhngocvuong / mp3-to-m4r.bat
Created August 17, 2018 17:36 — forked from TheZoc/mp3-to-m4r.bat
Convert a MP3 file to an Apple iPhone's ringtone file (M4R), using FFMPEG.
@echo off
rem =====================================================
rem Converts a MP3 file to a M4R file using ffmpeg.
rem Usage: Drop a MP3 file at the top of this batch file.
rem =====================================================
set ffmpeg_exe="C:\ffmpeg\ffmpeg-20150619-git-bb3703a-win64-static\bin\ffmpeg.exe"
rem %~f1 = Full File Path, with drive letter
rem %~p1 = Drive Letter
rem %~p1 = Path Only
@dinhngocvuong
dinhngocvuong / getYoutubeVideoIdFromUrl.php
Created June 20, 2018 02:49
getYoutubeVideoIdFromUrl
function getYoutubeVideoIdFromUrl($url) {
preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i', $url, $match);
$youtubeId = $match[1];
return $youtubeId;
}
@dinhngocvuong
dinhngocvuong / youtube_id_regex.php
Created June 16, 2018 03:53 — forked from ghalusa/youtube_id_regex.php
Extract the YouTube Video ID from a URL in PHP
<?php
// Here is a sample of the URLs this regex matches: (there can be more content after the given URL that will be ignored)
// http://youtu.be/dQw4w9WgXcQ
// http://www.youtube.com/embed/dQw4w9WgXcQ
// http://www.youtube.com/watch?v=dQw4w9WgXcQ
// http://www.youtube.com/?v=dQw4w9WgXcQ
// http://www.youtube.com/v/dQw4w9WgXcQ
// http://www.youtube.com/e/dQw4w9WgXcQ
// http://www.youtube.com/user/username#p/u/11/dQw4w9WgXcQ