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 = ["/home/hernan/.config/alacritty/themes/themes/gruvbox_material_medium_dark.yaml"] | |
| live_config_reload = true | |
| [colors.bright] | |
| black = "#353539" | |
| blue = "#b9aeda" | |
| cyan = "#f591b2" | |
| green = "#9dc6ac" | |
| magenta = "#ecaad6" | |
| red = "#ffae9f" |
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 | |
| session=$(echo -e "$(find ~/code -mindepth 2 -maxdepth 2 -type d | awk -F/ '{print $(NF-1) "/" $NF}' | fzf-tmux -p 55%,60% --no-sort --border-label)") | |
| session_name=$(basename "$session" | tr . _) | |
| if ! tmux has-session -t "$session_name" 2> /dev/null; then | |
| tmux new-session -s "$session_name" -c "/home/hernanreyes/code/$session" -d | |
| fi |
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
| unbind r | |
| bind r source-file ~/.tmux.conf | |
| setw -g mode-keys vi | |
| bind-key h select-pane -L | |
| bind-key j select-pane -D | |
| bind-key k select-pane -U | |
| bind-key l select-pane -R | |
| # List of plugins |
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
| func main() { | |
| var warriors = Warriors{} | |
| warriors = append(warriors, NewMRSatan()) | |
| warriors = append(warriors, NewGoku()) | |
| executeWithoutIPS(warriors) | |
| } |
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
| type Goku struct{} | |
| func NewGoku() *Goku { | |
| return &Goku{} | |
| } | |
| func (g Goku) Kick() { | |
| println("Goku kicks") | |
| } |
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
| type MRSatan struct{} | |
| func NewMRSatan() *MRSatan { | |
| return &MRSatan{} | |
| } | |
| func (m MRSatan) Kick() { | |
| println("MRSatan kicks") | |
| } |
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
| type Warrior interface { | |
| Kick() | |
| Punch() | |
| Transform() | |
| } | |
| type Warriors []Warrior | |
| func executeWithoutIPS(warriors Warriors) { | |
| for _, warrior := range warriors { |
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
| // GetEmployees returns a list of employees with a pre-signed URL to their profile picture | |
| // to make the example easier to follow, I have a mock data with a list of employees, | |
| // so we don't need to use a database | |
| func (u FileManager) GetEmployees() ([]Employee, error) { | |
| for i, _ := range employees { | |
| preSignedURL, err := u.service.Presign(employees[i].Picture) | |
| if err != nil { | |
| return nil, fmt.Errorf("filemanager.GetEmployees(): %w", err) | |
| } |
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
| func (s Service) PresignV2(key string) (string, error) { | |
| req, _ := s.S3.GetObjectRequest(&s3.GetObjectInput{ | |
| Bucket: aws.String(s.Bucket), | |
| Key: aws.String(key), | |
| }) | |
| signedURL, err := req.Presign(time.Minute) | |
| if err != nil { | |
| return "", fmt.Errorf("s3.SignKey(): %v", err) | |
| } |
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
| // Presign signs a key object with an expiry time | |
| func (s Service) Presign(key string) (string, error) { | |
| req, err := http.NewRequest(http.MethodGet, fmt.Sprintf("https://%s.s3.amazonaws.com/%s", s.Bucket, key), nil) | |
| if err != nil { | |
| return "", fmt.Errorf("s3.Presign.http.NewRequest(): %w", err) | |
| } | |
| // we sign the request with the signTime and a time expiration of 1 day | |
| _, err = s.Signer.Presign(req, nil, "s3", *s.Session.Config.Region, time.Hour*24, getSignTime()) | |
| if err != nil { |
NewerOlder