Skip to content

Instantly share code, notes, and snippets.

View vctrtvfrrr's full-sized avatar
🇧🇷
(╯°□°)╯︵ ┻━┻

Victor Otávio Ferreira vctrtvfrrr

🇧🇷
(╯°□°)╯︵ ┻━┻
View GitHub Profile
@vctrtvfrrr
vctrtvfrrr / spacing.sass
Last active March 12, 2019 14:49
Sass spacing helper
$sizeUnit: rem
$marginKey: "m"
$paddingKey: "p"
$separator: "-"
$sizes: ("none", 0), ("auto", auto), ("xxs", 0.125), ("xs", 0.25), ("sm", 0.5), ("md", 1), ("lg", 2), ("xl", 4), ("xxl", 8)
$positions: ("t", "top"), ("r", "right"), ("b", "bottom"), ("l", "left")
@function sizeValue($key, $value)
@return if($key == "none" or $key == "auto", $value, $value + $sizeUnit)
@vctrtvfrrr
vctrtvfrrr / bash.sh
Created August 2, 2018 14:40
Remove git tags local and remotely
# Delete remote tags
git push origin --delete $(git tag -l)
# Delete local tags
git tag -d $(git tag -l)
@vctrtvfrrr
vctrtvfrrr / bash.sh
Created August 2, 2018 14:42
Compress and extract GZip on Linux
tar -czvf archive.tgz folder_or_file_name
tar -xzvf archive.tgz
@vctrtvfrrr
vctrtvfrrr / autologin.sh
Last active March 19, 2019 12:18
Generate SSH Key and SSH Autologin
# Generate SSH Key
ssh-keygen -t rsa -C "" -b 4096
# SSH Autologin
ssh USER@SERVER mkdir -p /path_to_remote/.ssh
cat /path_to_my/.ssh/id_rsa.pub | ssh USER@SERVER 'cat >> /path_to_remote/.ssh/authorized_keys'
ssh USER@SERVER "chmod 700 /path_to_remote/.ssh && chmod 640 /path_to_remote/.ssh/authorized_keys"
@vctrtvfrrr
vctrtvfrrr / bash.sh
Last active July 10, 2021 18:19
Export/Import MySQL database
# Export database to SQL file
mysqldump -u root -p database > database.sql
# Import database from SQL file
mysql -u root -p -h 127.0.0.1 database < database.sql
@vctrtvfrrr
vctrtvfrrr / mysql_backup.sh
Created August 2, 2018 14:47
Script to backup all MySQL databases in separated files.
#!/bin/bash
TIMESTAMP=$(date +"%F")
BACKUP_DIR="/backup/$TIMESTAMP"
MYSQL_USER="backup"
MYSQL=/usr/bin/mysql
MYSQL_PASSWORD="password"
MYSQLDUMP=/usr/bin/mysqldump
mkdir -p "$BACKUP_DIR"
@vctrtvfrrr
vctrtvfrrr / dump.php
Created August 2, 2018 14:50
PHP Dump and Die
<?php
/**
* Debug helper function. This is a wrapper for var_dump() that adds
* the <pre /> tags, cleans up newlines and indents before output.
*
* @param mixed $var The variable to dump.
* @param string $label OPTIONAL Label to prepend to output.
* @param bool $die OPTIONAL Die script execution.
* @return string
@vctrtvfrrr
vctrtvfrrr / .bash_aliases
Created August 2, 2018 14:51
Bash Aliases (Git, Laravel and Vue)
alias apti="sudo apt install -y"
alias hs="history | grep"
alias mkcd='foo(){ mkdir -p "$1"; cd "$1" }; foo '
alias myip="curl http://ipecho.net/plain; echo"
alias octal="stat -c '%a %n'"
alias snano="sudo nano"
alias update="sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get dist-upgrade -y && sudo apt-get autoremove -y && sudo apt-get autoclean -y"
alias gch="git checkout"
alias gl="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
@vctrtvfrrr
vctrtvfrrr / shell.sh
Created March 19, 2019 13:17
Fix my locale issue on Ubuntu
# Add those lines on /etc/default/locale
LC_CTYPE=en_US.UTF-8
LC_ALL=en_US.UTF-8
LANG=en_US.UTF-8
chore: 🤖
ci: 🎡
docs: ✏️
feat: 🎸
fix: 🐛
perf: ⚡️
refactor: 💡
release: 🏹
style: 💄
test: 💍