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 / home-end-fix.md
Created January 28, 2018 18:21
How to fix home and end keys on Mac OS X

How to fix home and end keys on Mac OS X

Open a terminal:

$ cd ~/Library
$ mkdir KeyBindings
$ cd KeyBindings
$ vi DefaultKeyBinding.dict
@thiagosf
thiagosf / gist:eb2ba7d24968873e745c61d2ee72c0d8
Last active September 25, 2023 10:44
Export ERD (diagrams) from SequelPro

Export ERD (diagrams) from SequelPro

Install graphviz

sudo brew install graphviz

Open SequelPro, choose database and export dot file. Now, run the command:

@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 / centos-apache-fix.md
Created July 30, 2019 23:45
CentOS and Apache: Permission denied

Error

[Tue Jul 30 23:32:08.018098 2019] [proxy:error] [pid 1845] (13)Permission denied: AH00957: HTTP: attempt to connect to 0.0.0.0:3000 (0.0.0.0) failed
[Tue Jul 30 23:32:08.018168 2019] [proxy:error] [pid 1845] AH00959: ap_proxy_connect_backend disabling worker for (0.0.0.0) for 60s

Resolution

@thiagosf
thiagosf / start.sql
Last active August 18, 2021 20:04
Criando database e usuário no MySQL
create database dbname character set utf8mb4 collate utf8mb4_general_ci;
create user 'username'@'localhost' identified by 'pass';
grant all privileges on dbname.* to 'username'@'localhost';
flush privileges;
@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 / 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 / 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