Skip to content

Instantly share code, notes, and snippets.

View djismgaming's full-sized avatar
😅
DockerMania!

Ismael djismgaming

😅
DockerMania!
View GitHub Profile
@djismgaming
djismgaming / chroot.sh
Created October 9, 2019 15:06
chroot to fix grub/fstab
$ sudo fdisk -l (From this you need to find the device name of your physical drive that won't boot, something like “/dev/sdxy″ - where x is the drive and y is the root partition. Since I was using a software RAID, root (/) was on md1)
$ sudo mount /dev/sdxy /mnt (Mount the root partition)
$ sudo mount --bind /dev /mnt/dev
$ sudo mount --bind /proc /mnt/proc
$ sudo mount --bind /sys /mnt/sys
$ sudo chroot /mnt (This will change the root of executables to your your drive that won't boot)
$ grub-mkconfig -o /boot/grub/grub.cfg (insure that there are NO error messages)
$ grub-install /dev/sdx (NOTE that this is the drive and not the partition. try grub-install --recheck /dev/sdxy if it fails)
Ctrl+D (to exit out of chroot)
$ sudo umount /mnt/dev
@djismgaming
djismgaming / diskspeed.sh
Last active September 24, 2019 20:06
disk transfer test
sudo hdparm -t --direct /dev/sda1 && sudo hdparm -t --direct /dev/sdb1 && sudo hdparm -t --direct /dev/sdc2
@djismgaming
djismgaming / openmediavault
Last active January 17, 2025 18:14
omv custom fstab mapping options in /etc/default/openmediavault
# /etc/default/openmediavault
# make edits before adding filesystems to omv
OMV_FSTAB_MNTOPS_EXT2="defaults,noatime,nodiratime,nofail,user_xattr,acl"
OMV_FSTAB_MNTOPS_EXT3="defaults,noatime,nodiratime,nofail,user_xattr,acl"
OMV_FSTAB_MNTOPS_EXT4="defaults,noatime,nodiratime,nofail,user_xattr,acl"
OMV_FSTAB_MNTOPS_JFS="defaults,nofail"
OMV_FSTAB_MNTOPS_XFS="defaults,nofail"
OMV_FSTAB_MNTOPS_VFAT="defaults,nofail"
OMV_FSTAB_MNTOPS_NTFS="defaults,nofail"
@djismgaming
djismgaming / portainer-external-network.yml
Created July 23, 2019 12:50
Portainer external network on stack
version: '2'
services:
mq:
image: rabbitmq:latest
container_name: sample-mq
restart: always
networks:
- web
ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -i "inputfile" -vf 'format=nv12,hwupload' -map 0:0 -map 0:1 -threads 2 -aspect 16:9 -y -f matroska -acodec copy -b:v 12500k -vcodec h264_vaapi "output file"
#for script
ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -i "$1" -vf 'format=nv12,hwupload' -map 0:0 -map 0:1 -threads 2 -aspect 16:9 -y -f matroska -acodec copy -b:v 12500k -vcodec h264_vaapi "$1_video"
@djismgaming
djismgaming / ffmpeg.md
Created June 12, 2019 12:59 — forked from protrolium/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:

@djismgaming
djismgaming / get-run-cmd
Created June 5, 2019 14:54 — forked from djmaze/get-run-cmd
Get run command from running Docker container
#!/bin/bash
set -eo pipefail
container=$1
image=$(docker inspect --format '{{.Config.Image}}' $container)
cmd=$(docker inspect --format '{{.Config.Cmd}}' $container)
if [[ $cmd == '<nil>' ]]; then cmd=''; fi
binds=$(docker inspect --format '{{.HostConfig.Binds}}' $container | sed "s/\[//; s/\]//")
if [[ $binds == '<nil>' ]]; then binds=''; fi
envs=$(docker inspect --format '{{.Config.Env}}' $container | sed "s/\[//; s/\]//")
@djismgaming
djismgaming / VAAPI-hwaccel-encode-Linux-Ffmpeg&Libav-setup.md
Created May 24, 2019 20:27 — forked from Brainiarc7/VAAPI-hwaccel-encode-Linux-Ffmpeg&Libav-setup.md
This gist contains instructions on setting up FFmpeg and Libav to use VAAPI-based hardware accelerated encoding (on supported platforms) for H.264 (and H.265 on supported hardware) video formats.

Using VAAPI's hardware accelerated video encoding on Linux with Intel's hardware on FFmpeg and libav

Hello, brethren :-)

As it turns out, the current version of FFmpeg (version 3.1 released earlier today) and libav (master branch) supports full H.264 and HEVC encode in VAAPI on supported hardware that works reliably well to be termed "production-ready".

@djismgaming
djismgaming / wanrebooter.sh
Created May 7, 2019 18:26
reboot machine if no internet is found
#!/bin/bash
target="google.com"
count=$( ping -c 1 $target | grep icmp* | wc -l )
if [ $count -eq 0 ]
then
date >> /home/user/pingfail.txt
/sbin/shutdown -r now
@djismgaming
djismgaming / weakref.py
Created April 25, 2019 00:25
Fix weakref.py issue on apt update under omv4
wget -O /usr/lib/python3.5/weakref.py \
https://raw.githubusercontent.com/python/cpython/9cd7e17640a49635d1c1f8c2989578a8fc2c1de6/Lib/weakref.py