How I built a post recommendation feature for my blog using text embeddings, GPT-4 and ChromaDB with LangChain| Ishan Das Sharma
The following script can be used to start list the running containers inside a particular network along with their ips. 1 2 3 #! /usr/bin/zsh echo "Image\tHostname\tIP"; for N in $(docker ps -q) ; do echo "$(docker inspect -f '{{.Config.Image}}\t{{ .Config.Hostname }}\t' ${N}) $(docker inspect -f '{{range $i, $value := .NetworkSettings.Networks}}{{if eq $i "custom_network_name"}}{{.IPAddress}}{{end}}{{end}}' ${N})"; done Usage example: 1 ./network-hosts Bonus tip: Pipe the output into column ...| Ishan Das Sharma
Given a list of items and a separator, render it in a single line, with separators between. 1 2 3 4 5 6 7 $items = [ "apples", "oranges", "bananas" ]; $separator = " / "; Method 1: Basic foreach This approach is the one that comes to mind first, but it is incorrect because it will emit an additional separator after the last element. 1 2 3 foreach ($items as $value) { echo $value .| Ishan Das Sharma
A note to the reader This post is a legacy post. The legacy posts that are available on this website were written many years ago. These posts are made available here for archival purposes only. They reflect the age I was, and the level of knowledge that I had when I wrote them, and they may contain outdated information, so please keep that in mind as you proceed to read this article.| Ishan Das Sharma