Skip to content

Instantly share code, notes, and snippets.

View pabloaugusto's full-sized avatar
:octocat:
Working Hard

Pablo Augusto pabloaugusto

:octocat:
Working Hard
View GitHub Profile
@pabloaugusto
pabloaugusto / nextcloud-rescan-index-after-manual-add-files.md
Last active June 2, 2024 16:54
Nextcloud: reindex / rescan user files after use shell to add files

Once you add or restore files manualy to a user "files" folder, you must tell nextcloud to rescan and reindex the user files library, otherwise the files will not show up on user front end view

The user files generally are stored on /data/USERAME path

occ files:scan --path="/USERNAME/files"
@pabloaugusto
pabloaugusto / ssh-docker-container-access.md
Created June 2, 2024 16:39
Access a docker container terminal

SERVER: server name, domain or ip

CONTAINER: container name or id

ssh -t root@SERVER "docker exec -it CONTAINER /bin/bash"
@pabloaugusto
pabloaugusto / linux-copy-move-files-recursively-search.md
Last active June 2, 2024 15:53
Linux (bash / shell): Move or copy files to a folder based on a recursive search

Move all image files at any subfolder (recursively) to a single folder.

In the example below, I need to move all images from all subfolders to a single folder

find /absolute/path/to/images  -name '*.png' | xargs -I files mv files /absolute/image/newpath

find /absolute/path/to/videos  -name '*.mp4' | xargs -I files mv files /absolute/video/newpath
@pabloaugusto
pabloaugusto / renovate.json5.md
Last active May 31, 2024 01:29
renovate: hack to use emoji on semantic commits

file: renovate.json5

{
  $schema: "https://docs.renovatebot.com/renovate-schema.json",
  
  extends: [
    "config:base",
  ],
@pabloaugusto
pabloaugusto / reset-github-repository-delete-all-comments.md
Last active May 30, 2024 06:18
reset github repository (delete all previous commits)
cd YOUR_PROJECT_DIR
rm -r .git
git init
git add .
git commit -m '🎉 feat: initial commit'
git remote add origin [email protected]:YOUR_USER/YOUR_REPO.git
git push --force --set-upstream origin master
If you have ever put something in a file like .bashrc and had it not work, or are
confused by why there are so many different files — .bashrc, .bash_profile, .bash_login,
.profile etc. — and what they do, this is for you.
The issue is that Bash sources from a different file based on what kind of shell it thinks
it is in. For an “interactive non-login shell”, it reads .bashrc, but for an “interactive
login shell” it reads from the first of .bash_profile, .bash_login and .profile (only).
There is no sane reason why this should be so; it’s just historical. Follows in more detail.
For Bash, they work as follows. Read down the appropriate column. Executes A, then B, then C,
etc. The B1, B2, B3 means it executes only the first of those files found.
@pabloaugusto
pabloaugusto / gist:057b5bf1fbaf59aab0cfe983126da23e
Created March 25, 2024 17:11
bash terminal with output colors
#!/bin/bash
printf "Colors:\n"
printf "\033[0;30mHello World! black\033[0m\n"
printf "\033[0;31mHello World! red\033[0m\n"
printf "\033[0;32mHello World! green\033[0m\n"
printf "\033[0;33mHello World! yellow\033[0m\n"
printf "\033[0;34mHello World! blue\033[0m\n"
printf "\033[0;35mHello World! pink\033[0m\n"
printf "\033[0;36mHello World! teal\033[0m\n"
@pabloaugusto
pabloaugusto / gist.powershell.set-change-windows-keyboard-language-layout.ps1
Last active May 30, 2024 06:19
Powershell: SET or CHANGE windows keyboard language / layout
# Steps:
# 1 - Choose the Keyboard layout from M$ documentation https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-input-locales-for-windows-language-packs?view=windows-11
# 2 - Identify Installed languages positions with "PS > Get-WinUserLanguageList"
# 3 - Add desired keyboard layout (if not present yet) to any installed language
# 4 - Apply settings
######################################################
# adding desired keyboard layout installed
# "0409:00020409" = en-US(International) KB Layout
######################################################
@pabloaugusto
pabloaugusto / gist:6d0a3274440f8af026e7096e84687b3b
Last active November 28, 2023 22:27
Auto-Restart MySQL When It Crashes
Load the crontab editor in the terminal with crontab -e and add the following line:
```
* * * * * service mysql status > /dev/null || service mysql start
```