Skip to content

Instantly share code, notes, and snippets.

View samirfor's full-sized avatar

Samir C. Costa samirfor

  • Brazil
  • 06:19 (UTC -03:00)
View GitHub Profile
@samirfor
samirfor / README.md
Created January 5, 2023 13:52 — forked from syukronrm/README.md
Fish Shell function for sourcing standard .env files

envsource

I've been using Fish shell for years which is great and all, but one thing that has got me frustrated is using it with .env files.

When attempting to run source .env in a project, I usually encounter this problem:

.env (line 2): Unsupported use of '='. In fish, please use 'set KEY value'.
from sourcing file .env
source: Error while reading file '.env'
@samirfor
samirfor / m3u8-to-mp4.md
Created May 21, 2018 14:47 — 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
@samirfor
samirfor / mongo_backup.sh
Last active May 10, 2017 13:17 — forked from sheharyarn/mongo_backup.sh
Mongodump All Databases Shell Script for Cronjob
#!/bin/sh
set -e
HOST_NAME="$(hostname)"
MONGO_HOST="127.0.0.1"
MONGO_PORT=27017
MONGO_USER="admin"
MONGO_PASS="password"
MONGO_AUTHDB="admin"
@samirfor
samirfor / ssl.cert.gen.sh
Last active September 2, 2016 13:10 — forked from 6farer/SSL cert generation.sh
Gera certificados SSL auto assinados | Generate SSL self signed certificates
#!/bin/bash
#
# este script é interativo, ou seja, requer intervenção do usuário
#
# Não abrevie as informações nem utilize caracteres especiais incluindo
# letras acentuadas.
#
# Country Name (Código de país de 2 letras)
# State or Province Name (Estado, por extenso)
# Locality Name (Cidade, por extenso)
@samirfor
samirfor / setup-bridge.sh
Created September 1, 2016 12:25 — forked from ismell/setup-bridge.sh
Scripts to re-create the docker0 bridge and setup a different ip subnet
#!/bin/bash -e
IFADDR="192.168.3.1/24"
if [[ ! ip link show docker0 ]]; then
ip link add docker0 type bridge
ip addr add "$IFADDR" dev docker0
ip link set docker0 up
iptables -t nat -A POSTROUTING -s "$IFADDR" ! -d "$IFADDR" -j MASQUERADE
fi