Skip to content

Instantly share code, notes, and snippets.

View arbolitoloco's full-sized avatar
🖤

Laura Rocha Prado arbolitoloco

🖤
View GitHub Profile
@arbolitoloco
arbolitoloco / snippet.sql
Created August 2, 2021 21:04
[Create new database] With UTF8 as character encoding #SQL
CREATE DATABASE mydatabase CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
@arbolitoloco
arbolitoloco / commandline.sh
Created July 15, 2021 16:48
[Edit crontab with nano] Forcing use instead of stupid VI #SQL
sudo env EDITOR=nano crontab -e
@arbolitoloco
arbolitoloco / snippet.sql
Created September 12, 2020 00:19
[turn safe mode off for updates] #SQL
/* Turn off */
SET SQL_SAFE_UPDATES = 0;
/* Don't forget to turn back on */
SET SQL_SAFE_UPDATES = 1;
@arbolitoloco
arbolitoloco / instructions.md
Last active June 1, 2020 20:45
[Keep server git version up to date] To pull changes from git #git

Keeping a server version up to date with git

(from the accepted answer to this StackOverflow question) Considering a scenario where you are in a production server, thus changes will NOT be commited from the server to Git, and ONLY will be pulling the most updated version from the Git server, here's what has to be done:

git checkout master
git fetch
git merge

If there are conflicts during the merge, and you want to overwrite your local version, you can do a hard reset (note: uncommited changes, even staged, will be lost):

@arbolitoloco
arbolitoloco / git.md
Created February 11, 2020 23:33
[Keep a fork updated] #git

When you're working on a fork in an open-source project, and you'll have to push your changes back to the main fork to merge them, you should try to keep your fork periodically updated with upcoming changes, as to avoid conflicts when it's time to submit a pull request.

Check your remotes, then fetch changes from your upstream/master branch, then merge them back to your fork, and push changes to your fork's remote:

git remote -v
git fetch upstream
git checkout master
git merge upstream/master
git push origin master
@arbolitoloco
arbolitoloco / git.md
Created February 11, 2020 23:29
[Keep branch updated] From changes incorporated into master #git

If you're developing something in a feature branch, that won't create a lot of conflicts with things being pushed into the master branch, and you'd like to keep your branch updated, do this periodically:

git checkout master
git pull origin master
git checkout myfeaturebranch
git merge master

This works similarly to the method for updating your fork. It's better than using rebase, because of commit history, and conflict resolution having to be done before the feature branch is merged back into master.

@arbolitoloco
arbolitoloco / git.md
Created February 11, 2020 22:44
[Move recent unpushed commits to new branch] #git

If you recently commited changes, but did not yet push them, and realized you were working in the wrong branch, you can use this method for keeping your commits in a new branch (found in this answer in StackOverflow):

Find which commits to keep. Let's say I want the latest 3 commits (formatted to show short head and description):

git log -n 3 --pretty="%h - %s"

This is just to confirm that I would only like to keep everything before the last 3 commits.

@arbolitoloco
arbolitoloco / exclude.git
Created January 28, 2020 23:40
[Ignore Materialize Sass files] Create exclude list of files for locally developing git #git
# Path to file: .git/info/exclude
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
.sass-cache/
*.sass-cache/
*.css.map
@arbolitoloco
arbolitoloco / suggestions.md
Created December 13, 2019 17:42
Wordpress file permissions #WordPress

After initial setup, folders should be owned by the actual user account managing it, and folder wp-content should be owned by www-data as well.

Relative Path Suggestion
/ 755
wp-includes 755
wp-admin 755
wp-admin/js 755
wp-content 755
@arbolitoloco
arbolitoloco / powershell.md
Created September 30, 2019 20:53
[Get file hashes in PowerShell] #PowerShell #windows
 get-filehash FILEPATH

e.g. get-filehash c:\test.txt.