Fix shebangs and bits for tangled scripts

This commit is contained in:
Gabriel Arazas 2022-11-23 17:39:22 +08:00
parent 57bdb6ca3a
commit e7b0921314
13 changed files with 62 additions and 14 deletions

View File

@ -1,4 +1,4 @@
#/usr/bin/env bash
#!/usr/bin/env bash
function help() {
echo "Usage: error_handling.sh <person>"
}

View File

@ -1,4 +1,4 @@
#/usr/bin/env bash
#!/usr/bin/env bash
main() {
echo "Hello, World!"
}

View File

@ -1,4 +1,4 @@
#/usr/bin/env bash
#!/usr/bin/env bash
set -eo pipefail
function help() {

View File

@ -1,4 +1,4 @@
#/usr/bin/env bash
#!/usr/bin/env bash
n=$1
valid=0
function is_factor {

View File

@ -1,4 +1,4 @@
#/usr/bin/env bash
#!/usr/bin/env bash
n=$1
valid=0
function is_factor {

View File

@ -1,2 +1,2 @@
#/usr/bin/env bash
#!/usr/bin/env bash
echo "$@" | rev

View File

@ -1,2 +1,2 @@
#/usr/bin/env bash
#!/usr/bin/env bash
echo "One for ${1:-"you"}, one for me."

View File

@ -0,0 +1,5 @@
#!/usr/bin/env bash
podman container list --format "{{.ID}} {{.Names}}" \
| fzf --multi --prompt "Choose containers to remove > " \
| awk '{print $1}' \
| xargs podman container rm

View File

@ -0,0 +1,5 @@
#!/usr/bin/env bash
podman image search --format "{{.Index}} {{.Name}}" alpine \
| fzf --multi --prompt "Choose images to install > " \
| awk '{print $2}' \
| xargs podman image pull

View File

@ -0,0 +1,5 @@
#!/usr/bin/env bash
podman image list --format "{{.ID}} {{.Repository}} {{.Tag}}" \
| fzf --multi --prompt "Choose images to remove > " \
| awk '{print $1}' \
| xargs podman image rm

View File

@ -0,0 +1,18 @@
#!/usr/bin/env bash
# Builds an image from the Dockerfile of the current directory.
podman build --tag todo-list-web-app .
# List the images to see if our app image has been built.
podman image list
# Assuming the app creates an HTTP server at port 5000, we'll expose it to the host, making it accessible from there.
podman run -d -p 5111:5000 todo-list-web-app
# See if we did run a containerized version of our app.
podman container list
# Tag the image with the convention seen in Docker registry.
podman tag foodogsquared/python-helloworld:v1.0.0
# Push the image to the Docker registry (assuming you've already logged in to Docker registry).
podman push foodogsquared/python-helloworld

View File

@ -3,7 +3,7 @@
:END:
#+title: Exercism track: Bash
#+date: "2021-05-11 15:06:43 +08:00"
#+date_modified: "2021-06-22 17:50:43 +08:00"
#+date_modified: "2022-09-04 22:17:41 +08:00"
#+language: en
#+source: https://exercism.io/my/tracks/bash
#+property: header-args :cache yes
@ -43,7 +43,7 @@ main() {
main
#+end_src
#+results[9110ed5ee1cd74dc35880e0e285e44fc1f04e858]:
#+results[98aae568f58e5e1b2267b6c21e9efbb8c8a555b3]:
: Hello, World!

View File

@ -3,9 +3,10 @@
:END:
#+title: Command line: Podman
#+date: "2021-06-10 11:51:26 +08:00"
#+date_modified: "2021-07-20 23:31:29 +08:00"
#+date_modified: "2022-11-23 17:48:46 +08:00"
#+language: en
#+property: header-args :eval no
#+property: header-args:bash :shebang "#!/usr/bin/env bash"
Podman is a daemonless container engine.
@ -38,17 +39,19 @@ Podman has Git-style command-line interface with subcommands and exclusive optio
+ =-t, --tag [NAME]= attaches a tag to the image.
+ =-f, --file [FILE]= sets the name of the Dockerfile to be built from.
- =run= will create a container from an image.
- =run= creates a container from an image quickly with the given subcommand.
+ =-d, --detach= will make the process run in the background.
+ =-it= will make an interactive shell.
+ =-p, --publish= exposes the port of the image to the host.
- =tag= will tag an existing image.
- =tag= tags an existing image.
Useful for correcting tags for pushing into a remote registry.
- =image= is anything about interaction with images.
In fact, a lot of the subcommands presented so far are aliases with =image= being the original — e.g., =image tag= vs =tag=, =image pull= vs =pull=, =image rm= vs =rmi=.
- =commit= creates a new image from a container, allowing to easily create one with all the changes you always have to apply previously.
@ -61,7 +64,7 @@ Podman is a big tool so it needs a big list of examples.
As with big tools, comes with a big quickstart.
#+begin_src shell
#+begin_src bash :tangle (my/concat-assets-folder "podman-quickstart")
# Builds an image from the Dockerfile of the current directory.
podman build --tag todo-list-web-app .
@ -98,9 +101,21 @@ podman image list --format "{{.ID}} {{.Repository}} {{.Tag}}" \
Yes, another one with fzf...
#+begin_src bash
#+begin_src bash :tangle (my/concat-assets-folder "fzf-podman-image-pull")
podman image search --format "{{.Index}} {{.Name}}" alpine \
| fzf --multi --prompt "Choose images to install > " \
| awk '{print $2}' \
| xargs podman image pull
#+end_src
** Interactive container removal
Basically, the previous scripts except for containers.
#+begin_src bash :tangle (my/concat-assets-folder "fzf-podman-container-rm")
podman container list --format "{{.ID}} {{.Names}}" \
| fzf --multi --prompt "Choose containers to remove > " \
| awk '{print $1}' \
| xargs podman container rm
#+end_src