Skip to content

Instantly share code, notes, and snippets.

@mvniekerk
mvniekerk / RsaIdValidator.java
Last active August 15, 2019 07:58
Validate a South African ID number
import java.time.YearMonth;
import java.util.Optional;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.Stream;
public class RsaIdValidator {
public static boolean validateRsaId(String id, boolean validateGender, boolean isMale) {
@overdrive3000
overdrive3000 / awscli.md
Last active June 10, 2022 15:50
AWS CLI tips and tricks

Get the default VPC Id

aws ec2 describe-vpcs --filters "Name=isDefault,Values=true" --output text --query 'Vpcs[*].{Vpc:VpcId}'

Get all the cloudformation stack names

aws cloudformation describe-stacks --region us-east-1 --output text --query 'Stacks[*].{Stack:StackName}'
@overdrive3000
overdrive3000 / git-tips.md
Last active May 27, 2021 20:24
Useful git commands

Search a string across commits

git log -S <string to find> --source --all

To find all commits that added or removed the fixed string string to find. The --all parameter means to start from every branch and --source means to show which of those branches led to finding that commit.

Find branches the commit is on

git branch --contains <commit>