Skip to content

Instantly share code, notes, and snippets.

@lizthegrey
lizthegrey / attributes.rb
Last active September 24, 2024 14:33
Hardening SSH with 2fa
default['sshd']['sshd_config']['AuthenticationMethods'] = 'publickey,keyboard-interactive:pam'
default['sshd']['sshd_config']['ChallengeResponseAuthentication'] = 'yes'
default['sshd']['sshd_config']['PasswordAuthentication'] = 'no'
@linux-china
linux-china / KetamaConsistentHash.java
Last active February 22, 2022 11:31
Ketama Consistent Hash with Java language implementation
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.util.List;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
public class KetamaConsistentHash<T> {