Skip to content

Instantly share code, notes, and snippets.

View mccarlosen's full-sized avatar
:octocat:

Carlos Meneses mccarlosen

:octocat:
View GitHub Profile
@mccarlosen
mccarlosen / gist:7a755d8aea445aa1e1a146f8058586eb
Last active December 12, 2023 13:38
Sync all directories
# on linux
rsync -v --info=progress2 --no-owner /media/user/DIRECTORY/* /media/user/DIRECTORY/DIRECTORY/
@mccarlosen
mccarlosen / ffmpeg_mkv_mp4_conversion.md
Created May 28, 2023 18:31 — forked from jamesmacwhite/ffmpeg_mkv_mp4_conversion.md
Easy way to convert MKV to MP4 with ffmpeg

Converting mkv to mp4 with ffmpeg

Essentially just copy the existing video and audio stream as is into a new container, no funny business!

The easiest way to "convert" MKV to MP4, is to copy the existing video and audio streams and place them into a new container. This avoids any encoding task and hence no quality will be lost, it is also a fairly quick process and requires very little CPU power. The main factor is disk read/write speed.

With ffmpeg this can be achieved with -c copy. Older examples may use -vcodec copy -acodec copy which does the same thing.

These examples assume ffmpeg is in your PATH. If not just substitute with the full path to your ffmpeg binary.

Single file conversion example

@mccarlosen
mccarlosen / script.sh
Created February 22, 2023 02:06
Boot partition is full in Linux Mint
OLDCONF=$(dpkg -l|grep "^rc"|awk '{print $2}')
CURKERNEL=$(uname -r|sed 's/-*[a-z]//g'|sed 's/-386//g')
LINUXPKG="linux-(image|headers|ubuntu-modules|restricted-modules)"
METALINUXPKG="linux-(image|headers|restricted-modules)-(generic|i386|server|common|rt|xen)"
OLDKERNELS=$(dpkg -l|awk '{print $2}'|grep -E $LINUXPKG |grep -vE $METALINUXPKG|grep -v $CURKERNEL)
YELLOW="\033[1;33m"
RED="\033[0;31m"
ENDCOLOR="\033[0m"
sudo apt-get purge $OLDKERNELS
@mccarlosen
mccarlosen / phpunit-assertions.md
Created April 7, 2022 23:17 — forked from briankip/phpunit-assertions.md
A list of PHPUnit assertions
  • assertArrayHasKey
  • assertArrayNotHasKey
  • assertContains
  • assertAttributeContains
  • assertNotContains
  • assertAttributeNotContains
  • assertContainsOnly
  • assertAttributeContainsOnly
  • assertNotContainsOnly
  • assertAttributeNotContainsOnly
@mccarlosen
mccarlosen / github_desktop_ubuntu.sh
Created March 30, 2022 19:46 — forked from berkorbay/github_desktop_ubuntu.md
To install Github Desktop for Ubuntu
## Follow this link for further updates to Github Desktop for Ubuntu https://github.com/shiftkey/desktop/releases/latest
# UPDATE (2021-10-18): Thanks to Amin Yahyaabadi's message, the updated code is as follows
sudo wget https://github.com/shiftkey/desktop/releases/download/release-2.9.3-linux3/GitHubDesktop-linux-2.9.3-linux3.deb
### Uncomment below line if you have not installed gdebi-core before
# sudo apt-get install gdebi-core
sudo gdebi GitHubDesktop-linux-2.9.3-linux3.deb
# UPDATE (2021-03-05): Thanks to PaoloRanzi81's comment, the updated code is as follows https://gist.github.com/PaoloRanzi81
@mccarlosen
mccarlosen / expression-language-example.php
Last active December 15, 2021 21:52
Expression Language - Symfony Component
<?php
include(__DIR__ . '/vendor/autoload.php');
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
$expressionLanguage = new ExpressionLanguage();
var_dump($expressionLanguage->evaluate('2 + 5 / 2')); // float(4.5)
@mccarlosen
mccarlosen / git-snippets
Last active November 25, 2021 16:45
Git Snippets
1) Create a branch with the tag
git branch {tagname}-branch {tagname}
git checkout {tagname}-branch
2) Delete and recreate the tag locally
git tag -d {tagname}
git tag {tagname}
3) Delete and recreate the tag remotely
git push origin :{tagname} // deletes original remote tag
@mccarlosen
mccarlosen / PDFViewer.php
Created March 7, 2021 20:14
PDFViewer Livewire Component
<?php
namespace App\Http\Livewire\Components;
use Livewire\Component;
class PdfViewer extends Component
{
public $openModal = false;
public $titleModal = "PDF Viewer";
use App\Http\Livewire\Component;
Route::middleware('auth:web')->group(function () {
Route::get('/zona-privilegiada/{id}', Component::class)->name('routeName');
});
@mccarlosen
mccarlosen / EventSystem.js
Created July 21, 2020 15:44 — forked from simonberger/EventSystem.js
Global event system for React.js
class EventSystem {
constructor() {
this.queue = {};
}
publish(event, data) {
let queue = this.queue[event];
if (typeof queue === 'undefined') {
return false;