Skip to content

Instantly share code, notes, and snippets.

View Lecarvalho's full-sized avatar
🐍

Leandro Carvalho Lecarvalho

🐍
View GitHub Profile
@Lecarvalho
Lecarvalho / deplace-lot-of-files.sh
Created February 26, 2024 08:04
When mv is not possible because of large quantity of files, this command helps
echo !(*.jpg|*.png|*.bmp) | xargs mv -t ../
@Lecarvalho
Lecarvalho / autoSetupRemote.sh
Created January 20, 2023 13:43
git push.autoSetupRemote
git config --global --add --bool push.autoSetupRemote true
@Lecarvalho
Lecarvalho / gist:59157ec170d268cf2dddd38a5c51115f
Created April 8, 2022 20:35
azure devops create pull request via command line
az repos pr create --title "PULL REQUEST TITLE" --target-branch master --open
@Lecarvalho
Lecarvalho / git-commands-to-show-diffs-on-pr.
Last active January 19, 2022 14:35
if the changes are not shown on the pull request (file is too large)
git checkout BRANCH-TO-MERGE
git pull
git checkout PR-BRANCH-NAME
git diff BRANCH-TO-MERGE (often main/master/develop)
@Lecarvalho
Lecarvalho / replace-value-on-file.sh
Created August 20, 2021 21:11
Replace variable on file via bash
sed -i "s/value-to-replace-on-file/new-value/" file.txt
@Lecarvalho
Lecarvalho / create-ssh-key.md
Last active August 20, 2021 21:12
Create ssh key
  1. Generate the public and the private keys on local machine (give a name if you need)
ssh-keygen
  1. Copy the content for .pub file

  2. Create a file under $USER/.ssh/authorized_keys on the server if it does not exists yet

  3. Paste the content of the .pub file on the authorized_keys file, save and close the file

# telegraf troubleshoot initialize
/usr/bin/telegraf --config /etc/telegraf/telegraf.conf --config-directory /etc/telegraf/telegraf.d
# Discard all local commits
git reset --hard origin/[branch]
# Discard last commit on remote and discard local changes
git reset --hard HEAD~1
# Discard last commit on remote and keep change files in local
git reset --soft HEAD~1
@Lecarvalho
Lecarvalho / move_project_org_gcp
Created June 11, 2021 10:29
Move project from another organisation GCP
gcloud alpha projects move PROJECT_ID --organization ORGANIZATION_ID
@Lecarvalho
Lecarvalho / ServicePattern.cs
Last active May 19, 2021 10:34
Pattern for implementing services
namespace Domain.Entities
{
public abstract class EntityBase
{
public abstract bool isValid();
}
public class Auth : EntityBase
{
public string username;