Skip to content

Instantly share code, notes, and snippets.

View lyarinet's full-sized avatar

Asif Agaria lyarinet

View GitHub Profile
@prof3ssorSt3v3
prof3ssorSt3v3 / app.js
Created March 26, 2021 22:02
PWA 6 - Handling Install Events
const APP = {
deferredInstall: null,
init() {
if ('serviceWorker' in navigator) {
//register our service worker
navigator.serviceWorker
.register('/sw.js', {
updateViaCache: 'none',
scope: '/',
})
@Rafat97
Rafat97 / A.md
Last active January 20, 2021 16:17
📼 FFMPEG Some Command 📼

📼 FFMPEG Command 📼

@rowe-morehouse
rowe-morehouse / ffmpeg-commands.sh
Last active August 26, 2022 07:40
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:
@jmatthewturner
jmatthewturner / transcode.sh
Last active April 5, 2023 00:03
Bash Script for using FFMPEG to Transcode Video for DaVinci Resolve or Lightworks
#!/bin/bash
# This script uses ffmpeg to transcode video files into one of a few formats suitable for
# editing in either DaVinci Resolve or Lightworks on a Linux machine. It's purpose is to
# simplify my life and relieve me from having to look up and enter the same very long
# command over and over.
#
# If run with argument "all", the script will prompt for a directory containing video files, and
# transcode all video files in the directory into the selected format. If run with a file as an
# argument, it will transcode only that file, and will provide the additional option of
#!/bin/bash
# check file for AVC encoding and flv, wmv, or mkv wrapper and rewrap in mp4 container
# otherwise, if not already am mp4, transcode to AVC mp4
########
# usage:
# z264 <file>
# z264 *
# z264 *.ext
# z264 */*
@lakuapik
lakuapik / stats.php
Created August 31, 2019 05:08
Get uptime, memory usage, cpu usage and disk usage on GNU/Linux server using PHP
<?php
header('Content-Type: application/json');
function get_uptime()
{
$str = @file_get_contents('/proc/uptime');
$num = floatval($str);
$secs = (int) fmod($num, 60); $num = intdiv($num, 60);
$mins = $num % 60; $num = intdiv($num, 60);
# find the IP addresses of many hosts on the network
# step 1. obtain the broadcast address from ifconfig
# step 2. ping the broadcast address
$ ifconfig -a | grep broadcast
inet 192.168.1.102 netmask 0xffffff00 broadcast 192.168.1.255
inet 192.168.68.1 netmask 0xffffff00 broadcast 192.168.68.255
inet 192.168.174.1 netmask 0xffffff00 broadcast 192.168.174.255
$ ping 192.168.1.255
PING 192.168.1.255 (192.168.1.255): 56 data bytes
64 bytes from 192.168.1.1: icmp_seq=0 ttl=64 time=0.634 ms
@stoyanovgeorge
stoyanovgeorge / avg_speed.sh
Last active November 3, 2024 19:13
An one line command to get the average RX and TX speed of a particular interface (eth0) over $INT seconds in bytes per second. You need to divide by 128 to get it in Kbps or by 131072 (128*1024) for Mbps.
#!/bin/bash
INT=2; RXDIR=/sys/class/net/eth0/statistics/rx_bytes; TXDIR=/sys/class/net/eth0/statistics/tx_bytes; RXSTART=$(cat $RXDIR); TXSTART=$(cat $TXDIR); sleep $INT; RXEND=$(cat $RXDIR); TXEND=$(cat $TXDIR); RXBPS="$(((RXEND-RXSTART)/INT))"; TXBPS="$(((TXEND-TXSTART)/INT))"; echo "$RXBPS" "$TXBPS"
@tingplenting
tingplenting / ffmpeg_tuts.md
Last active August 20, 2024 06:59
ffmpeg cli for youtube

Extract audio from a YouTube video file

ffmpeg -i INPUT.mp4 -ab 256k OUTPUT.mp3

Cut 3s length

ffmpeg -y -ss 00:00:03 -i INPUT.mp4 -codec copy OUTPUT.mp4