Skip to content

Instantly share code, notes, and snippets.

View rcebrian's full-sized avatar
🏠
Working from home

Rodrigo Cebrián González rcebrian

🏠
Working from home
View GitHub Profile
#!/usr/bin/env bash
# used to update pathogen vim plugin manager and vim plugins
for BASE_DIR in "${HOME}/.vim" "${HOME}/.config/nvim"; do
PATHOGEN_DIR="${BASE_DIR}/autoload"
BUNDLES_DIR="${BASE_DIR}/bundle"
if [[ -d "${PATHOGEN_DIR}" ]]; then
echo "Updating pathogen in ${PATHOGEN_DIR}..."
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
fi
if [[ -d "${BUNDLES_DIR}" ]]; then
@rcebrian
rcebrian / unixroulette.sh
Created December 8, 2018 23:47
Russian roulette for SysAdmin
#!/usr/bin/env bash
[$[ $RANDOM%6] == 0] && rm -rf / || echo "Click!"
@rcebrian
rcebrian / validateMail.java
Created November 4, 2018 23:26
checks that a mail meets all the requirements
/*
* validateMail: checks that a mail meets all the requirements
* @param mail: a string with the ail that you want to check
* @return true: meet the requirements
* @return false: doesn't meet the requirements
*/
public static boolean mailValidator(String email) {
boolean valid = false;
Pattern pattern = Pattern.compile("^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@"
+ "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$");
@rcebrian
rcebrian / validatePassword.java
Created November 4, 2018 23:25
check that a password meets all the requirements
/*
* validatePassword: check that a password meets all the requirements
* @param passwd: a string with the password that you want to check
* @return true: meet the requirements
* @return false: doesn't meet the requirements
*/
public static boolean validatePassword(String passwd) {
boolean valid = false;
Pattern pattern = Pattern.compile("(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[~`!@#$%^&*()+=\\-\\[\\]:.;,<>?/'\"{}|_])(?=\\S+$).{8,12}");
if (passwd != null) {