Skip to content

Instantly share code, notes, and snippets.

@Lecarvalho
Lecarvalho / create-ssh-key.md
Last active April 2, 2026 02:02
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;
@Lecarvalho
Lecarvalho / README.md
Last active April 2, 2026 02:03 — forked from developius/README.md
Setup SSH keys for use with GitHub/GitLab/BitBucket etc

Create a new repository, or reuse an existing one.

Generate a new SSH key:

ssh-keygen -t rsa -C "your_email@example.com"

Copy the contents of the file ~/.ssh/id_rsa.pub to your SSH keys in your GitHub account settings (https://github.com/settings/keys).

Windows only: Open Windows Services, enable and start the service OpenSSH Authentication Agent

@Lecarvalho
Lecarvalho / add_env_var_zsh.sh
Created May 17, 2021 11:49
add env variable zsh
$ echo 'export ENV_VAR=12345' >> ~/.zshenv
echo $ENV_VAR
@Lecarvalho
Lecarvalho / gist:74bceb22e85005291f1912fea1874614
Created August 26, 2020 22:05
revert a modified file from a pull-request - ex: dev web.config :D
git checkout pull-request-branch
git checkout origin/master -- src/main/java/HelloWorld.java
git commit -m "revert a modified file from pull request"
git push origin pull-request-branch
@Lecarvalho
Lecarvalho / git_reate_and_push_existant_repo.cmd
Last active May 29, 2021 12:23
After creating the new repo, we just want to push the existant files to git
git init &&
git add . &&
git commit -m "first commit" &&
git branch -M main &&
git remote add origin url.git &&
git push -u origin main
@Lecarvalho
Lecarvalho / save_credentials_git_linux.file
Created December 31, 2019 16:54
save credential git linux
git config --global credential.helper cache