Skip to content

Instantly share code, notes, and snippets.

@marianocordoba
marianocordoba / userdata.sh
Last active February 1, 2023 20:12
Caddy server user data for AWS EC2
#!/bin/bash
sudo su
yum update -y
yum install yum-plugin-copr -y
yum copr enable @caddy/caddy -y
yum install caddy -y
printf ":80\nrespond \"Hello from $HOSTNAME\"" > /etc/caddy/Caddyfile
caddy start --config /etc/caddy/Caddyfile
@marianocordoba
marianocordoba / README.md
Last active January 24, 2020 15:03
Print a shield to the console

Print a shield to the console.

Example
console.shield('Version', '1.0.0')

Version 1.0.0

@marianocordoba
marianocordoba / .bashrc
Last active May 13, 2021 15:58
Cool bash prompt
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
}
show_git_branch() {
if [ ! -z "$(parse_git_branch)" ]; then
echo -e "\001\033[48;5;8;38;5;4m\002\ue0b0\001\033[0m\002\001\033[0;48;5;8m\002 \uf418 $(parse_git_branch) \001\033[0m\002\001\033[0;38;5;8m\002\ue0b0\001\033[0m\002 "
else
echo -e "\001\033[38;5;4m\002\ue0b0\001\033[0m\002 "
fi
@marianocordoba
marianocordoba / TopWords.hs
Last active February 21, 2018 02:50
TopWords
import System.Environment
import System.Exit
import Data.Char
import Data.List
import Data.Tuple
import Data.List.Split
import qualified Data.Map.Strict as Map
main = getArgs >>= parseArgs
@marianocordoba
marianocordoba / BST.java
Created November 1, 2017 01:20
Java implementation of binary search tree
package tree;
/**
* Binary search tree implementation
*/
public class BST<T extends Comparable<? super T>> implements Tree<T> {
/**
* A class representing a node of the binary tree.
*/