Append this to your ~/.zshrc file.
function preexec() {
timer=$(($(date +%s%0N)/1000000))
package main | |
import ( | |
"fmt" | |
) | |
var ( | |
ones = []string{ | |
"zero", "one", "two", "three", "four", | |
"five", "six", "seven", "eight", "nine", |
package main | |
import ( | |
"fmt" | |
"time" | |
) | |
func main() { | |
fmt.Println(unixToTime(time.Now().UnixMilli())) | |
} |
#!/usr/bin/env bash | |
DATABASE_URL="postgres://MyPostgresUser:MyPostgresPassword@192.168.0.1:5432/MyPostgresDB" | |
# `cut` is used to cut out the separators (:, @, /) that come matched with the groups. | |
DATABASE_USER=$(echo $DATABASE_URL | grep -oP "postgres://\K(.+?):" | cut -d: -f1) | |
DATABASE_PASSWORD=$(echo $DATABASE_URL | grep -oP "postgres://.*:\K(.+?)@" | cut -d@ -f1) | |
DATABASE_HOST=$(echo $DATABASE_URL | grep -oP "postgres://.*@\K(.+?):" | cut -d: -f1) | |
DATABASE_PORT=$(echo $DATABASE_URL | grep -oP "postgres://.*@.*:\K(\d+)/" | cut -d/ -f1) |