Skip to content

Instantly share code, notes, and snippets.

View thiagosf's full-sized avatar
🏠
Always working at home

Thiago Silva Ferreira thiagosf

🏠
Always working at home
View GitHub Profile
@thiagosf
thiagosf / mp4-reduce-quality.sh
Last active August 31, 2024 14:42
Reduce the quality of a video
ffmpeg -i orignal.mp4 -c:v libx264 -b:v 500k -pass 1 -an -f mp4 analyze.log && \
ffmpeg -i orignal.mp4 -c:v libx264 -b:v 500k -pass 2 -an -movflags +faststart output.mp4
@thiagosf
thiagosf / fix-amfi-sip-is-off.sh
Created September 11, 2022 22:47
Fixing unsupported Mac OS version error: AMFI - Sip is off...
# Reference: https://forums.macrumors.com/threads/macos-10-15-catalina-on-unsupported-macs.2183772/page-342?post=28233431#post-28233431
mount -uw /
nvram boot-args="-no_compat_check amfi_get_out_of_my_way=1"
reboot
@thiagosf
thiagosf / startup.sh
Last active August 28, 2022 12:51
Open Docker only after the volume is mounted (max os)
#!/bin/bash
counter=0
while [ $counter -lt 1000 ]
do
echo "checking... $counter"
if [[ $(/sbin/mount | awk '$3 == "/Volumes/Docker" {print $3}') != "" ]]; then
echo "mounted! wait 10 seconds to start docker..."
sleep 10
@thiagosf
thiagosf / resize.sh
Last active July 3, 2022 13:44
Bulk image resize
mkdir resized
sips -s formatOptions 90 --resampleWidth 1060 *.jpg --out resized
@thiagosf
thiagosf / docker-compose.yml
Created August 14, 2021 12:20
Nodejs + MySQL basic development structure with docker-compose
version: "3"
services:
web:
image: node
container_name: node-project-api
working_dir: /var/www
ports:
- 3000:3000
volumes:
- ./api:/var/www
@thiagosf
thiagosf / encypt-decrypt-openssl.sh
Created July 3, 2021 13:25
Encrypt/decrypt a string using openssl
# reference: https://stackoverflow.com/a/47517988/6649757
echo 'foo' | openssl aes-256-cbc -a -salt
echo 'U2FsdGVkX1/QGdl4syQE8bLFSr2HzoAlcG299U/T/Xk=' | openssl aes-256-cbc -a -d -salt
@thiagosf
thiagosf / change-autofill.scss
Created November 6, 2020 14:45
Mixin to change autofill inputs of Chrome
@mixin changeAutofill {
/* Change Autocomplete styles in Chrome*/
input:-webkit-autofill::first-line,
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
select:-webkit-autofill,
@thiagosf
thiagosf / copy-ftp-files.sh
Last active September 24, 2020 16:27
Copy all files from FTP in background with nohup
nohup wget -r -l 0 --user="user" --password="pass" ftp://domain.com/ . &
@thiagosf
thiagosf / js-to-ts.md
Last active August 4, 2021 14:58
JavaScript to TypeScript Migration

JavaScript to TypeScript Migration

Replaces:

^const ([^ ]+) = require\(([^)]*)\)$
import $1 from $2

^const ([^ ]+) = require\(([^)]*)\).(.*)$
import { $3 as $1 } from $2
@thiagosf
thiagosf / restore-git.md
Created June 17, 2020 14:37
Restore deleted file in git

List commits with file is inside

git log --oneline --follow -- path/to/file

The result looks like:

8266b41 Removing file