Skip to content

Instantly share code, notes, and snippets.

Reference

(Create self-signed CA to trust your own certs)[https://stackoverflow.com/questions/60218484/how-to-trust-all-my-self-signed-certificates-in-my-app]
  1. Create the environment:

    mkdir CA

  2. Create the CA key

@erikson1970
erikson1970 / server_walk.sh
Created June 2, 2021 21:52
Walks through a list of servers and checks their ping time, uptime and DT
#!/bin/bash
LOCALmachine=$(hostname -f)
nownow=$(date +"%s")
#insert list of machines which you can SSH to:
reversePingMachines="hostname1.local hostname2.local"
#insert list of machine you can't SSH to - eg router,switches
forwardPingMachines="192.168.13.1 192.168.13.40"
@erikson1970
erikson1970 / FFMPEG-Video-Speed.md
Last active April 25, 2021 19:37
Modify Video Speed with ffmpeg

Modify Video Speed with ffmpeg

David Walsh

I watch a lot of sports and recently I've become fascinated with some of the methodologies they use to illustrate events within the game. I don't have their advanced TV software or hardware, of course, but I do have a love for ffmpeg, which allows me to do everything from clip videos to change video formats, create tacky highlight videos with emo techno music combine audio and video, and more.

One of my favorite TV sports illustration techniques is speeding video up (time-lapse) or slowing it way down (slo-mo replay); naturally I wanted to know how to manipulate video speed with ffmpeg. It turns out all you need to do is pass in filter with a PTS (presentation timestamp) value: Faster Video Speed

ffmpeg -i input.mp4 -filter:v "setpts=0.5*PTS" output.mp4
@erikson1970
erikson1970 / fail2banStatusReport.sh
Last active February 20, 2021 18:30
creates a status file for fail2ban current jails and make discrete log for each violating party - suitable for cron-jobbing
#!/bin/bash
if [[ "$#" -lt 1 ]]; then
workDir=.
else
workDir=${1}
fi
if [[ "$#" -lt 2 ]]; then
workFile=./fail2banStatusReport.log
else
workFile=${2}
@erikson1970
erikson1970 / makeFileSmaller.sh
Created February 19, 2021 19:16
Converts a video file to a much smaller version of itself. Transcribes the exif parameters also.
#!/bin/bash
ffmpeg -i "${1}" -vf "scale=720:-1" -c:s copy -c:v libx264 -crf 27 -c:a aac -b:a 96k -strict -2 -preset slow $(basename "${1}" ".${1##*.}").${2}
exiftool -TagsFromFile "${1}" "$(basename "${1}" ".${1##*.}").${2}"
@erikson1970
erikson1970 / m3u8-to-mp4.md
Created February 16, 2021 14:52 — forked from tzmartin/m3u8-to-mp4.md
m3u8 stream to mp4 using ffmpeg

1. Copy m3u8 link

Alt text

2. Run command

echo "Enter m3u8 link:";read link;echo "Enter output filename:";read filename;ffmpeg -i "$link" -bsf:a aac_adtstoasc -vcodec copy -c copy -crf 50 $filename.mp4
@erikson1970
erikson1970 / vpn.md
Created December 22, 2020 20:32 — forked from joepie91/vpn.md
Don't use VPN services.

Don't use VPN services.

No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.

Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.

  • A Russian translation of this article can be found here, contributed by Timur Demin.
  • A Turkish translation can be found here, contributed by agyild.
  • There's also this article about VPN services, which is honestly better written (and has more cat pictures!) than my article.
@erikson1970
erikson1970 / ffmpeg_mkv_mp4_conversion.md
Created December 22, 2020 02:29 — 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

@erikson1970
erikson1970 / SD_Card_Writing.md
Last active December 11, 2020 19:27
write SD card using SD from a compressed image
  • using XZcat

xzcat -c -d Debian-Stretch64-1.0-20180202-C2.img.xz | dd iflag=fullblock bs=4M | sudo dd iflag=fullblock oflag=direct conv=fsync status=progress bs=4M of=/dev/sdb

@erikson1970
erikson1970 / IOTstackPullRequest.md
Created December 11, 2020 14:07 — forked from Paraphraser/IOTstackPullRequest.md
Preparing IOTstack Pull Requests

Preparing a Pull Request for IOTstack

If you want to fix a bug or propose an enhancement for IOTstack, you will need to prepare a Pull Request (PR).

Please don't try to do anything in this gist inside an ~/IOTstack folder on a Raspberry Pi that is also being used to run your Docker containers. It's easy to get confused and you could accidentally break your own working IOTstack.

You can do everything on the same Raspberry Pi that is running your IOTstack but it's usually easier to work on a desktop or laptop. If you accept this advice, there's no risk of breaking your running IOTstack.

This guide barely scratches the surface of Pull Requests. There is lots of advice on GitHub and Google will find plenty of hits for any question you might have.