This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const APP = { | |
deferredInstall: null, | |
init() { | |
if ('serviceWorker' in navigator) { | |
//register our service worker | |
navigator.serviceWorker | |
.register('/sw.js', { | |
updateViaCache: 'none', | |
scope: '/', | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 */* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
Based on https://evilmartians.com/chronicles/better-web-video-with-av1-codec
ffmpeg -i SOURCE.mov -map_metadata -1 -c:a libfdk_aac -c:v libx264 -crf 24 -preset veryslow -profile:v main -pix_fmt yuv420p -movflags +faststart -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" video.h264.mp4
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
NewerOlder