Skip to content

Instantly share code, notes, and snippets.

View deffjay's full-sized avatar

Jeff Day deffjay

View GitHub Profile
@deffjay
deffjay / ffmpeg-commands.sh
Created November 2, 2022 02:29 — forked from 44213/ffmpeg-commands.sh
ffmpeg commands.
# To extract the sound from a video and save it as MP3:
ffmpeg -i <video.mp4> -vn <sound>.mp3
# To convert frames from a video or GIF into individual numbered images:
ffmpeg -i <video.mpg|video.gif> <frame_%d.png>
# To combine numbered images (frame_1.jpg, frame_2.jpg, etc) into a video or GIF:
ffmpeg -i <frame_%d.jpg> -f image2 <video.mpg|video.gif>
# To quickly extract a single frame from a video at time mm:ss and save it as a 128x128 resolution image:
@deffjay
deffjay / phpfpm_swoole_benchmark.md
Last active March 4, 2024 01:54
PHP-FPM / Swoole Benchmarks

PHP-FPM / Swoole - Performance Comparison!

Here are some comparative benchmarks of our API using PHP-FPM vs Laravel Octane (Swoole) endpoints.

Test Hardware - Setup

  • Macbook Pro (15-inch, 2018) - 2.6 GHz 6-Core Intel Core i7. 32 GB 2400 Mhz
  • MySQL - 8.0
  • PHP - 8.0.3
  • Laravel - 8.83.5
@deffjay
deffjay / ffmpeg.md
Created November 16, 2021 03:12 — forked from liangfu/ffmpeg.md
using ffmpeg to extract audio from video files

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

Convert WAV to MP3, mix down to mono (use 1 audio channel), set bit rate to 64 kbps and sample rate to 22050 Hz:

@deffjay
deffjay / create_new_user.sh
Last active October 4, 2020 22:34
Properly creates a new user for CentOS/RHEL/Fedora/Debian
#!/bin/bash
# Create a new user named morpheus
useradd -m -s /bin/bash morpheus
# Add users to sudo or wheel group
usermod -aG sudo morpheus #Debian/Ubuntu
usermod -aG wheel morpheus #CentOS/RHEL
# Create Home Directory + .ssh Directory
@deffjay
deffjay / installing_clockwork_for_laravel.md
Last active July 18, 2020 07:13
Install clockwork profiling library for Laravel > 5.5

Install the Clockwork library via Composer.

$ composer require itsgoingd/clockwork --dev

If you are running the latest Laravel version, congratulations you are done!

By default, Clockwork will only be available in debug mode, you can change this and other settings in the configuration file. Use the vendor:publish Artisan command to publish the configuration file into your config directory.

@deffjay
deffjay / gist:6e0de6bb767b8c0533049541a48b91bd
Last active September 30, 2019 19:25
Pretty print JSON from an object in Swift5
do {
let jsonEncoder = JSONEncoder()
jsonEncoder.outputFormatting = .prettyPrinted
let jsonData = try jsonEncoder.encode(palettes)
if let jsonString = String(data: jsonData, encoding: .utf8) {
print(jsonString)
}
} catch {
print("error")
}
@deffjay
deffjay / docker-cleanup-resources.md
Created February 27, 2018 18:52 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

mysql -h 127.0.0.1 -u root -p"*******" database < applications.sql
mysql -h 127.0.0.1 -u root -p"******" database < publishers.sql
@deffjay
deffjay / tmux-cheatsheet.markdown
Created October 20, 2015 03:20 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"