mirror of
https://github.com/foo-dogsquared/wiki.git
synced 2025-01-31 04:58:21 +00:00
Fix shebangs and bits for tangled scripts
This commit is contained in:
parent
57bdb6ca3a
commit
e7b0921314
@ -1,4 +1,4 @@
|
|||||||
#/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
function help() {
|
function help() {
|
||||||
echo "Usage: error_handling.sh <person>"
|
echo "Usage: error_handling.sh <person>"
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
main() {
|
main() {
|
||||||
echo "Hello, World!"
|
echo "Hello, World!"
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
|
|
||||||
function help() {
|
function help() {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
n=$1
|
n=$1
|
||||||
valid=0
|
valid=0
|
||||||
function is_factor {
|
function is_factor {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
n=$1
|
n=$1
|
||||||
valid=0
|
valid=0
|
||||||
function is_factor {
|
function is_factor {
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
#/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
echo "$@" | rev
|
echo "$@" | rev
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
#/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
echo "One for ${1:-"you"}, one for me."
|
echo "One for ${1:-"you"}, one for me."
|
||||||
|
5
notebook/assets/cli.podman/fzf-podman-container-rm
Executable file
5
notebook/assets/cli.podman/fzf-podman-container-rm
Executable 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
|
5
notebook/assets/cli.podman/fzf-podman-image-pull
Executable file
5
notebook/assets/cli.podman/fzf-podman-image-pull
Executable 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
|
5
notebook/assets/cli.podman/fzf-podman-image-rm
Executable file
5
notebook/assets/cli.podman/fzf-podman-image-rm
Executable 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
|
18
notebook/assets/cli.podman/podman-quickstart
Executable file
18
notebook/assets/cli.podman/podman-quickstart
Executable 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
|
@ -3,7 +3,7 @@
|
|||||||
:END:
|
:END:
|
||||||
#+title: Exercism track: Bash
|
#+title: Exercism track: Bash
|
||||||
#+date: "2021-05-11 15:06:43 +08:00"
|
#+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
|
#+language: en
|
||||||
#+source: https://exercism.io/my/tracks/bash
|
#+source: https://exercism.io/my/tracks/bash
|
||||||
#+property: header-args :cache yes
|
#+property: header-args :cache yes
|
||||||
@ -43,7 +43,7 @@ main() {
|
|||||||
main
|
main
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
#+results[9110ed5ee1cd74dc35880e0e285e44fc1f04e858]:
|
#+results[98aae568f58e5e1b2267b6c21e9efbb8c8a555b3]:
|
||||||
: Hello, World!
|
: Hello, World!
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,9 +3,10 @@
|
|||||||
:END:
|
:END:
|
||||||
#+title: Command line: Podman
|
#+title: Command line: Podman
|
||||||
#+date: "2021-06-10 11:51:26 +08:00"
|
#+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
|
#+language: en
|
||||||
#+property: header-args :eval no
|
#+property: header-args :eval no
|
||||||
|
#+property: header-args:bash :shebang "#!/usr/bin/env bash"
|
||||||
|
|
||||||
|
|
||||||
Podman is a daemonless container engine.
|
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.
|
+ =-t, --tag [NAME]= attaches a tag to the image.
|
||||||
+ =-f, --file [FILE]= sets the name of the Dockerfile to be built from.
|
+ =-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.
|
+ =-d, --detach= will make the process run in the background.
|
||||||
+ =-it= will make an interactive shell.
|
+ =-it= will make an interactive shell.
|
||||||
+ =-p, --publish= exposes the port of the image to the host.
|
+ =-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.
|
Useful for correcting tags for pushing into a remote registry.
|
||||||
|
|
||||||
- =image= is anything about interaction with images.
|
- =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=.
|
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.
|
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.
|
# Builds an image from the Dockerfile of the current directory.
|
||||||
podman build --tag todo-list-web-app .
|
podman build --tag todo-list-web-app .
|
||||||
|
|
||||||
@ -98,9 +101,21 @@ podman image list --format "{{.ID}} {{.Repository}} {{.Tag}}" \
|
|||||||
|
|
||||||
Yes, another one with fzf...
|
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 \
|
podman image search --format "{{.Index}} {{.Name}}" alpine \
|
||||||
| fzf --multi --prompt "Choose images to install > " \
|
| fzf --multi --prompt "Choose images to install > " \
|
||||||
| awk '{print $2}' \
|
| awk '{print $2}' \
|
||||||
| xargs podman image pull
|
| xargs podman image pull
|
||||||
#+end_src
|
#+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
|
||||||
|
Loading…
Reference in New Issue
Block a user