Skip to content

Instantly share code, notes, and snippets.

View cweckesser's full-sized avatar

Carlos Weckesser cweckesser

  • Copenhagen, Denmark
View GitHub Profile
  1. Login to AWS account
aws-vault exec <PROFILE_NAME>
  1. List contexts
kubectl config get-contexts
@cweckesser
cweckesser / postgres_query_from_shell_script.sh
Created January 17, 2023 13:11
[Postgres] Run a Postgres query from a shell script
psql -At \
postgresql://HOST_NAME:PORT/DATABASE \
-U USERNAME \
-c "SELECT NOW()"
@cweckesser
cweckesser / useful_linux_commands.md
Last active August 11, 2023 09:41
[CLI] Useful Linux commands

Get the latest modified file in a directory

sudo find PATH_TO_DIRECTORY -exec stat -c "%y %n" {} \; | sort -n | tail -n 1

NOTE: Use sudo or login as root in order to access other users locations.

  • find command details:
    • -exec: Execute the following command for each result of the find command.
@cweckesser
cweckesser / postgres_dumps.sh
Last active January 19, 2023 08:11
[Postgres] Database backup scripts
# Data and structure dump
pg_dump \
--no-owner \
--no-acl \
-h DB_HOST \
-p DB_PORT \
-U DB_USERNAME \
-n DB_SCHEMA \
DB_NAME \
@cweckesser
cweckesser / pretty_logging_react_components_with_testing_library.ts
Created January 13, 2023 13:27
[React] Pretty logging of react components with Testing Library
import { prettyDOM, render } from '@testing-library/react';
it('should...', async () => {
const { container } = render(<MyComponent />);
console.log(prettyDOM(container));
});
@cweckesser
cweckesser / util_docker_cli_commands.sh
Last active October 13, 2023 13:08
[Docker] Util Docker CLI commands
# Build Docker image
docker-buildx build \
-t REPOSITORY_NAME/TAG_NAME:VERSION \
--platform linux/amd64 \
.
# Build Docker image from specific Dockerfile
docker-buildx build \
-t REPOSITORY_NAME/TAG_NAME:VERSION \
--platform linux/amd64 \
@cweckesser
cweckesser / zsh_customizations.md
Last active January 12, 2023 20:32
[ZSH] Themes, fonts & plugins

Installing Oh my zsh!

sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Theme

Edit the .zshrc file:

@cweckesser
cweckesser / git_cli_command_aliases.sh
Last active January 12, 2023 20:32
[ZSH] Aliases for git CLI commands
# ----------------------
# Git Aliases
# ----------------------
# git add
alias ga='git add'
alias gaa='git add .'
alias gaaa='git add --all'
alias gau='git add --update'
### Keybase proof
I hereby claim:
* I am cweckesser on github.
* I am carlosweckesser (https://keybase.io/carlosweckesser) on keybase.
* I have a public key ASBelA6gFNAqZL-I8k3wBRbf-gNtJ-6hTb037Lw8mXfP1Ao
To claim this, I am signing this object: