This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Map; | |
public class RomanToInteger { | |
private static final Map<Character, Integer> symbols = | |
Map.of('I', 1, 'V', 5, 'X', 10, 'L', 50, 'C', 100, 'D', 500, 'M', 1000); | |
public int convert(String romanNumeral) { | |
int result = 0; | |
for (int i = 0; i < romanNumeral.length(); i++) { | |
char currentChar = romanNumeral.charAt(i); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import io.micronaut.context.annotation.ConfigurationProperties; | |
import java.net.URI; | |
@ConfigurationProperties("micronaut.http.services.my-service") | |
public class MyServiceConfiguration { | |
public static final String ID = "my-service"; | |
private URI url; | |
public URI getUrl() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kubectl get pods --all-namespaces | grep Error | awk '{print $2, "--namespace", $1}' | xargs kubectl delete pod |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# list all nodes | |
kubectl get nodes | |
# list all pods of specified node | |
kubectl get pods --all-namespaces -o wide --field-selector spec.nodeName=<node-name> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
function getNodes() { | |
kubectl get --raw=/api/v1/nodes | jq -r '.items[].metadata.name' | |
} | |
function getPVCs() { | |
jq -s '[flatten | .[].pods[].volume[]? | select(has("pvcRef")) | '\ | |
'{name: .pvcRef.name, capacityBytes, usedBytes, availableBytes, '\ | |
'percentageUsed: (.usedBytes / .capacityBytes * 100)}] | sort_by(.name)' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kubectl top pods --all-namespaces --containers=true --sort-by=memory | |
kubectl top pods --all-namespaces --containers=true --sort-by=cpu |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat /etc/upstream-release/lsb-release | |
# Example output: | |
# DISTRIB_ID=Ubuntu | |
# DISTRIB_RELEASE=20.04 | |
# DISTRIB_CODENAME=focal | |
# DISTRIB_DESCRIPTION="Ubuntu Focal Fossa" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Adaptado da página oficial do pgAdmin: https://www.pgadmin.org/download/pgadmin-4-apt/ | |
# Testado na versão 20.3 (una) | |
# | |
# Setup the repository | |
# | |
# Install the public key for the repository (if not done previously): | |
sudo curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo apt-key add |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Edit your .zshrc/.bashrc/whatever and add this line to create an alias | |
alias multipull="find . -mindepth 1 -maxdepth 1 -type d -print -exec git -C {} pull \;" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Pesquisa uma string recursivamente ignorando alguns diretórios comuns em projetos node, java, etc | |
grep -Hrn 'text_to_find' --exclude-dir 'node_modules' --exclude-dir 'build' --exclude-dir 'bin' --exclude-dir 'public' . |