36 KiB
Anki: 2021
- Finding devices
$PATH
environment- Testing systemd timestamps
- Enabling desktop integration
- Flatpak permissions
- The basics of Flatpak apps
- Changing user shell
- Printing a list in the shell
- systemd timestamp example
- Type checking in Bash
- Emacs: The overview of buffers
- The basics of Emacs modes
- Emacs: Eagle's eye view of a window
- Emacs: Point and marker
- Interacting with buffers in Elisp
- String comparison in Emacs Lisp
- Using the help system in Emacs
- Emacs: Word manipulation
- Emacs: Line manipulation
- Vim: Jump to previous jump point
- Vim: Enter jump point
- Vim: Go to file path
- Set as a pager
- Vim: Show outline/table of content
- Detect files through Vim filetypes
- Going to keyword definitions in Vim
- Vim modes
- Word wrapping in Vim
- Using the help system
- Pitfalls and illusions of competence
- org-babel
- org-babel modes
- Creating files with Org mode
- Dynamic content with Org mode
- Org mode: Asciidoctor-styled callouts
- Org mode: Timestamps and durations
- Org mode: Deadlines and schedules
- Org mode: Quick file navigation
- Editing source code blocks in Org mode documents
- Practices for studying
- Focused and diffused mode
- Benefits of sleep
- Bash conditional with an unset variable
- Bash conditional with a set variable
- Shell help system
- Basic music notation reading 1
- Basic music notation reading 2
- Basic music notation reading 3
- Watch the logs of a systemd unit
- Restoring a file in Git
- Setting environment variables with systemd environment directive
- Emacs Lisp conditionals
- Finding out file types in the shell
- Factors to consider when choosing an architecture for cloud applications
- Monolith and microservices
- Duckduckgo bangs
- Best application development practices
- Cloud Native Computing Foundation
- Container workflow
- Kubernetes resources
- Kubernetes external user access
- Platform mechanisms
- Platform mechanisms: business models
- Linux kernel options
My collection of tips and tricks I collected in 2021.
Finding devices
Front
How to list devices information? (I mean all sorts of devices.)
Back
lspci
lists PCI devices.lsusb
list USB-connected devices.lsblk
list the block devices which usually includes storage drives and such.
$PATH
environment
Front
How does a shell find the binaries?
Back
Most shell searches through the $PATH
variable, a colon-delimited list of paths containing the binaries.
Testing systemd timestamps
Front
How to test out systemd timestamps?
Back
systemd-analyze {calendar,timestamp,timespan}
To know how the format (i.e., calendar, timestamp, and timespan) looks like, you can refer to man systemd.time.5
.
Enabling desktop integration
Front
How to make desktop environments recognize the desktop files?
Back
Most of the desktop environments and certain applications like Rofi refers to the XDG_DATA_DIRS
environment variable, a list of colon-delimited paths similar to PATH
.
This enables desktop integration with certain tools like Nix and Guix package manager. Here's how to integrate installed Nix packages into the desktop.
XDG_DATA_DIRS=$HOME/.nix-profile/share:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}
Flatpak permissions
Front
What permissions does user-installed Flatpak apps have by default?
Back
By default, they have none. Among the default limitations:
- They can only access their own runtime folder
$HOME/.var/app/${FLATPAK_APP_ID}
. - They cannot access the network.
Some apps are installed with the request to allow the following permissions enabled (e.g., Zotero).
If left with no permissions, you'll see in certain situations like a file browser dialog that the permissions is in effect. Below are some of the examples interacting with the permissions of an app.
# Show the permissions of an app.
flatpak permission-show ${FLATPAK_APP_ID}
# Let the user-installed Flatpak app access the home directory.
flatpak override --user --filesystem=home ${FLATPAK_APP_ID}
The basics of Flatpak apps
Front
What is a Flatpak package? Does it have its own form of managing dependencies?
Back
A Flatpak package can either be a runtime or a standalone app.
Runtimes are the basic dependencies of an application. Only select packages available as a runtime (e.g., Qt, GTK).
Flatpak has its set of runtimes composed of system libraries to be used with the applications. Thus, it stays out of its way with the operating system's libraries. The developer can also bundle its own set of libraries.
Changing user shell
Front
How to change user shell in most Linux distros?
Back
chsh
Printing a list in the shell
Front
Give some ways to print a list in the shell.
Back
# Format the string.
printf "%s\n" foo bar 'baz ;;'
# Echo the string as-is.
echo "foo
bar
baz ;;"
# Print with escaped newlines.
echo -e "foo\nbar\nbaz ;;"
foo bar baz ;; foo bar baz ;; foo bar baz ;;
systemd timestamp example
Front
What is *-*-8/4
in systemd calendar format?
Back
Every 4 days, starting from the 8th of the month.
Assuming this was executed on 2021-05-12.
systemd-analyze calendar *-*-8/4
Original form: *-*-8/4 Normalized form: *-*-08/4 00:00:00 Next elapse: Sun 2021-05-16 00:00:00 PST (in UTC): Sat 2021-05-15 16:00:00 UTC From now: 3 days left
Type checking in Bash
Front
Implement a little bit of type checking in Bash.
Back
printf
throws an error if the given argument is not appropriate.
# This is fine
printf "%d\n" 532 429 40 102
# This will return a non-zero exit code
printf "%d\n" this_will_throw_an_error 430 that_previous_number_will_not
# This is also fine
printf "%f\n" 10 43.45 3.14
532 429 40 102 0 430 0 10.000000 43.450000 3.140000
Emacs: The overview of buffers
Front
What is an Emacs buffer?
Back
A buffer is anything that Emacs displays.
It usually display file contents among other examples with butterfly
, doctor
, or the starting buffer when you first open Emacs.
While buffers usually have an associated file path, a buffer doesn't need one. This is one of the concepts that is applied to other text editors (Vim, Atom, Visual Studio Code).
The basics of Emacs modes
Front
What is a mode in Emacs?
Back
A mode is set of behavior quite similar to Vim modes.
Emacs further divides modes into two.
Major modes are Emacs' way of supporting programming languages and file formats.
Programming language support usually comes in major mode — e.g., R-mode
for R files, python-mode
for Python scripts, org-mode
for Org mode documents.
Think of them as an equivalent to Vim's filetype.
Only one major mode can be activated in one buffer at a time and all buffers have a major mode.
Minor modes usually contain little behavioral changes that improve the editing experience. When enabled, some of them are global modes — affecting every buffer in your session. Others are only buffer-local — affecting only the buffer when you activated the mode. Unlike major modes, multiple minor modes can be enabled at any given time.
Emacs: Eagle's eye view of a window
Front
What is considered window in Emacs?
Back
A window is where the buffers are being displayed. One window can display all buffers but only one at a time. To display two buffers at a single time, just add another window.
All windows display the same buffer; if the buffer is modified in one of the window, it will show the changes in all windows.
Emacs: Point and marker
Front
What is a point and a marker in Emacs?
Back
A point is the current location of the cursor in the buffer.
You can get the point with point
function.
Often helpful for interacting with buffers.
A marker is another point in the buffer. It is usually found when interacting with regions when asked for the two points (i.e., the beginning and the ending position). Furthermore, a marker can be used to save locations and jump back to that marker when asked.
Interacting with buffers in Elisp
Front
Give a rough example on how to do the following in Emacs Lisp:
Create a temporary buffer named "hello" containing an Org mode document with a "Hello world" entry.
Back
(with-temp-buffer
(insert "* Hello world")
(rename-buffer "hello")
(org-mode))
String comparison in Emacs Lisp
Front
How to compare two strings in Emacs Lisp?
Back
(string= STR1 STR2)
(print (string= "WHOA" "whoa"))
(print (string= "WHOA" (upcase "whoa")))
(print (string= "Hello world" "HeLL0 World"))
nil t nil
Using the help system in Emacs
Front
Name different ways to use the help system inside Emacs.
Back
help-for-help
is the most comprehensive help section (in my opinion).describe-*
series of functions are the next. Among the list of describe functions, you have:describe-key
,describe-function
,describe-variable
, anddescribe-package
. You can just open up the minibuffer and see what else is there.apropos
is similar to Unix apropos command which searches for every symbol in Emacs.
Emacs: Word manipulation
Front
Give some functions on word manipulations inside Emacs.
Back
The following functions have multiple variations each for a character ($F-char
), word ($F-word
), region ($F-region
), and region or point ($F-dwim
).
capitalize-*
for making the first of the word in uppercase.downcase-*
for making a region all lowercase.upcase-*
for making a region all uppercase.
evil-mode has a keybinding associated with uppercase and downcase a certain region with evil-upcase
and evil-downcase
, respectively.
Emacs: Line manipulation
Front
Give some functions on manipulating lines while in Emacs.
Back
- evil-mode has
evil-join
which works the same way Vim's join complete with smart spacing and everything. fill-region
is useful for formatting requirements/preferences like in the Linux kernel where the maximum width of 80 characters. evil-mode has an associated keybinding function withevil-fill
.sort-lines
is pretty useful for the common task of sorting lines. Though, not useful for items that consist of multiple lines.
Vim: Jump to previous jump point
Front
In Vim, how to get back in previous jump point?
Back
Ctrl + O
Remember it as getting out of the current jump point and back to the previous one.
Vim: Enter jump point
Front
How to jump into a keyword with Vim?
Back
Ctrl + ]
will enter into the definition block of a keyword.K
also has the same effect.
Vim: Go to file path
Front
In Vim, how to go to the file path at point?
Back
gf
(in normal mode) as in goto file.
Set as a pager
Front
How to set Vim as a manpager?
Back
MANPAGER="nvim +Man!"
+Man!
is a command invocation (as if entering :Man
inside Vim).
It can also be written as -c Man!
.
The :Man!
command displays the current buffer as a manual page.
Vim: Show outline/table of content
Front
How to show the table of contents of a document in Vim?
Back
gO
, although the results are filetype-specific (and some don't have any).
Helpful examples include for manual pages and help pages (from :help
).
Detect files through Vim filetypes
Front
How does Vim detect the files?
Back
Vim guesses the file by assigning filetypes, mainly through the file name and reading the file content. A filetype is how Vim knows what plugins to apply to the current buffer.
Vim has a few built-in filetypes such as shell, manual pages, Markdown, Asciidoc, xmodmap, patch files, and JSON among others (that are in $VIMRUNTIME/filetype.vim
).
For more information, run :help filetype
inside Vim.
Going to keyword definitions in Vim
Front
How to go to the keyword definition in Vim?
Back
gd
as in go to definition.
Though, not all the time it will do what its supposed to do.
For better effect, you can generate a Ctags file which Vim has a built-in integration (see :h ctags
).
Vim modes
Front
What is a mode (in Vim)?
Back
A Vim mode is a set of behavior and actions. In this case, it considers editing and navigation (among other modes) to be separate. Thus, you need to switch between them to do those things.
Vim has built-in modes which you can see with :h vim-modes
.
Word wrapping in Vim
Front
How to do word wrapping (in Vim)?
Back
gw
as in go format the words.
By default, it simply line wraps the lines with the 80-character limitation.
Using the help system
Front
How to effectively make use of the help system of Vim?
Back
The usual way is to execute :h
or :help
.
You can view what does a keybinding do with :h ${KEYBINDING}
— e.g., :h gw
to know what gw
does, :h V
for viewing visual line mode.
For keybindings in visual and command line mode, prepend them with v_
and c_
, respectively.
Pitfalls and illusions of competence
Front
Give various pitfalls and illusions of competence to look out when learning.
Back
- The presence of the material itself can cause students to foolishly think they already know about the subject.
- Similarly, studying with solutions can be a trap if you focus on the what and how rather than the why.
- Various common practices such as highlighting, rereading, and mind mapping are not as effective and only applicable in specific situations.
- The einstellung mindset, being invested in an idea that you can't see other solutions.
- Similarly, overlearning can occur if you're aiming for complete mastery when you should move on after understanding the concept.
org-babel
Front
What makes Org mode popular for reproducible research?
Back
org-babel, the library that enables superpowers for Org mode source code blocks.
Among the list of features, org-babel makes the following things easier for creating lab notebooks.
- Execute the source code block and print results.
- Create files from source code blocks, making it possible to create an entire computational report with a single Org mode document.
- Metaprogramming with noweb-inspired system making dynamic content possible.
- Individual control over source code blocks with sessions, export options, and variables.
- Pass values between different source code blocks even in different programming languages.
org-babel modes
Front
How to make org-babel pass values between different source code blocks?
Back
First, configure org-babel to work in functional mode (i.e., :results value
) in a source code block.
With functional mode, it will return values which will be handled by org-babel.
#+name: num
#+begin_src python :results value
return 53
#+end_src
The value cannot be passed unless it has a name that others can reference yet so add a name property to the source code block (i.e., #+name: ${NAME}
).
Now here's a different source code block written in a different language.
To pass a value, you have to configure with :var ${VARNAME}=${NAME}
.
#+begin_src ruby :var num=num :results output
print(num)
#+end_src
Creating files with Org mode
Front
How to create files with Org mode source code blocks?
Back
The :tangle
option enables extracting code blocks into files.
Accepted values include yes
, no
, or a relative path to the Org document where the file will be written.
Dynamic content with Org mode
Front
Is creating dynamic content in Org mode possible? If so, how?
Back
Yes!
By attaching a name to a code block and evaluating them, it is possible.
Here's an example of a source code block with a default argument.
#+name: greeting
#+header: :var name="World"
#+begin_src sh
echo "Hello ${name}"
#+end_src
You can then call the function in different ways:
- For calling it inline,
call_${FUNC_NAME}()
. - For creating a block,
#+call: ${FUNC_NAME}()
. - For invoking inside a code block,
<<${FUNC_NAME}()>>
, but you have to enable noweb (e.g.,:noweb yes
).
You can then pass header arguments by appending in square brackets ([]
) before invoking it — e.g., call_greeting[:results replaces]()
, #+call: greeting[:results replace]()
, <<greeting[:results replace]()>>
.
Org mode: Asciidoctor-styled callouts
Front
Are Asciidoctor-style callouts possible in Org mode? If so, how?
Back
Surprisingly, yes! It is just hidden on the documentation. Specifically, on the Literal examples section of the Org mode manual.
Here's an example to do it.
#+begin_src python
print("Hello world") # (ref:hello)
print(2 + 5) # (ref:num)
#+end_src
In [[(hello)][line 1]], we have printed the traditional "Hello world" program.
In [[(num)][the second line]], we've done a simple arithmetic and printed it into the console.
To create Asciidoctor-styled callouts, create a reference inside of the code block and refer to it (i.e., (${ref})
).
Org mode: Timestamps and durations
Front
How to denote timestamps and durations in Org mode?
Back
# A timestamp looks like this.
<2021-05-07 Fri>
# To make a duration, just put two dashes between two timestamps.
<2021-05-07 Fri>--<2021-05-08 Sat>
To make creating timestamps easier, execute org-time-stamp
(or whatever keybinding you've set).
Org mode: Deadlines and schedules
Front
How to make deadlines and schedules in Org mode entries?
Back
Just prepend the keywords DEADLINE
and SCHEDULED
, respectively.
DEADLINE: <2021-06-30 Wed>
SCHEDULED: <2021-06-29 Tue>
Org mode: Quick file navigation
Front
Give some ways how to navigate Org mode documents quickly.
Back
- I don't need to explain what
org-babel-next-src-block
andorg-babel-previous-src-block
does. org-backward-heading-same-level
is the same asorg-forward-heading-same-level
but moves one headline backwards.org-forward-heading-same-level
moves one headline forward in the same level. Useful for navigating sections and subsections.org-goto
creates an interface for showing the outline and it is a great navigation function. Highly recommend to use it with a completion interface (e.g.,counsel-org-goto
,counsel-org-imenu
).org-num-mode
adds a (non-persistent) counter to the document. Very helpful in navigating larger files.org-sort
will sort the entries into your preferred criteria. It also works on a list of items which is very useful if one of the list items has more than one line.
Editing source code blocks in Org mode documents
Front
What function creates a buffer for certain elements in org-mode but it is especially useful for editing source code blocks where it will open with the correct major mode?
Back
org-edit-special
Practices for studying
Front
Give various practices for studying effectively.
Back
- Recalling is one of the more effective practices compared to rereading or highlighting. Self-testing is one of the better strategies, overall.
- Prefer spaced repetition over cramming as scientifically, the learning process takes some time to settle.
- Get the key ideas ahead and as you're studying, fill the details. This includes skimming — reading through the chapter, looking at the keywords.
- Practice interleaving your studies — that is, studying other subjects and/or moving to later topics as you understand the topic.
- Focus, understand, and practice. Learning can occur bottom-up (learning the details of a problem) and top-down (learning the bigger picture of a topic). Using both creates context and that's where you put your understanding to the test as you learn when to apply what you've learn.
- Use memory palace technique — that is, to create analogies, narratives, and mnemonics.
- Have efficient amount of sleep. Sleep has certain processes that helps our brain like removing toxins in our brain that accumulate when we're awake, eliminating less relevant neural structures in favor of strengthening stronger ones for tomorrow, and thinking of a solution of the thing you worry about.
Focused and diffused mode
Front
What is focused and diffused mode? When those two modes often found in certain situations?
Back
Focused mode is when you are in the middle of a mentally intensive task — e.g., cooking, writing, reading, studying. In this process, you gather all of the information that are immediately required to complete it.
Diffused mode is the state of mental relaxation — e.g., taking a walk, watching a movie, recess and lunchtime. This is when the brain takes the focused task into the background and let random thoughts pass by. This is the reason why we sometimes get a sudden realization (a Eureka! moment).
Benefits of sleep
Front
How does sleep help in the learning process?
Back
Sleep has certain processes that helps our brain.
- Removing toxins in our brain that accumulate when we're awake.
- Eliminating less relevant neural structures in favor of strengthening stronger ones for tomorrow.
- Thinking of a solution in the background of the thing you worry about.
Bash conditional with an unset variable
Front
In Bash, what does ${HOME:-"/home/me"}
means?
Back
If $HOME
is unset, substitute with the given value (i.e., /home/me
).
Bash conditional with a set variable
Front
In Bash, what does ${HOME:+"/home/me"}
means?
Back
If $HOME
has a value, then return the given value (i.e., /home/me
).
Shell help system
Front
Give some ways to make use of the help system in the shell (or most Unix environment).
Back
- help sections (i.e.,
--help
or-h
) - manual pages (i.e.,
man
) - TexInfo (i.e.,
info
) - tldr pages (i.e., with clients like tealdeer)
Basic music notation reading 1
Front
What notes are displayed (in order)?
<<lilypond-paper-config>>
{
c a' f b
}
Back
C A F B
Basic music notation reading 2
Front
What notes are displayed (in order)?
<<lilypond-paper-config>>
{
\chordmode { c1 }
\relative c' { e f a }
}
Back A
C major triad (i.e., C E G). Then the notes E, F, and A.
Basic music notation reading 3
Front
What notes are displayed (in order)?
<<lilypond-paper-config>>
{
c''1 d' <c' a'> <e' b'> <f'' g'>
}
Back
C, D, C-A (a major sixth), E-B (a minor fifth), and G-F (a seventh).
Watch the logs of a systemd unit
Front
What is happening with the following command?
journalctl -u backup -fb
Back
Watch the logs from the systemd unit backup.service
starting from boot time.
The command could also be written in the same way.
journalctl --unit backup --follow --boot
Restoring a file in Git
Front
How to restore a file in Git?
Back
git restore $FILE_PATH
Despite the name, it will also delete the file if it's detected as untracked file in the Git worktree.
Setting environment variables with systemd environment directive
Front
How to set environment variables with systemd?
Back
Create an environment directive file in the specified directory.
You can find the search paths and the syntax from environment.d.5
manual page.
Basically, it is a shell-like config for setting environment variables. The following shows that.
TERM=alacritty
EDITOR=nvim
BROWSER=brave
MANPAGER="nvim +Man!"
PATH=${PATH:+$PATH:}${GUIX_PROFILE:-$HOME/.guix-profile}/bin
XDG_DATA_DIRS=${GUIX_PROFILE:-$HOME/.guix-profile}/share:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}
Compared to exporting values with the user shell (e.g., .bashrc
, .zshrc
) where they are only applied when the shell is called, environment variables generated from the directive can be recognized from applications that called non-interactively (e.g., GNOME desktop search, Rofi).
You can also view the resulting environment with systemctl show-environment
.
Emacs Lisp conditionals
Front
Give some functions for creating a conditional in Emacs Lisp.
Back
Below are the common way to control the flow with Elisp.
(if (and nil nil)
"Hello there!"
"Not hello there, sith lord!")
(unless t
"Not hello there, sith lord!")
(when t
"Hello there!")
Finding out file types in the shell
Front
Give some ways how to show the file type in the shell.
Back
file --mime-type $FILE
xdg-mime query filetype $FILE
I prefer file --mime-type
since it is clearer on purpose and name alone.
Factors to consider when choosing an architecture for cloud applications
Front
Give the factors to consider how a cloud application should be made of.
Back
- Scalability
- Development complexity
- Time to deploy
- Flexibility
- Reliability
- Operational costs
For easier memorization, just use the mnemonic "Slide down to Freedom Ravine, Olsen."
Take note that however you compose an application whether with a monolistic or composable approach, there are tradeoffs to consider. For example, with reliability that describes the ability to recover from a failure, a monolith application would have to retrieved with its entire stack. Composable services only require the faulty service to be examined.
Monolith and microservices
Front
What are monolith and microservices?
Back
A monolithic application store all of its components in one repository. It is usually done in one programming language to tie everything together. While it is nice to have it bundled in one package, a monolith can easily reach limit and scale slower. Furthermore, for debugging, it would take a reproduction of the whole stack to get an idea of what is happening.
On the other hand, an application built with microservices is just a bundle of individual services. Each component can be developed in parallel and made up of wildly different tools and languages appropriate for their purpose. Since components are individualized, you can just inspect one of the components.
Duckduckgo bangs
Front
List some Duckduckgo bangs you often use.
Back
As of 2021-06-09, here are some of the bangs I use.
wikipedia
orw
google
org
twitter
ortw
github
orgh
youtube
oryt
twitch
orttv
archwiki
oraw
researchgate
orrgate
arxiv
orarx
orcid
Best application development practices
Front
Give the list of practices and their summary from the SUSE Cloud native fundamentals scholarship program.
Back
- Health checks provide a way to check if a component is active.
- Metrics provides quick feedback such as the number of active users, number of logins for today, and how many users know a certain feature (or clicked the button).
- Logs records what happened on your application* thus making debugging easier. A recommended practice for logging is creating log levels to indicate the severity of the problem and attaching a timestamp.
- Tracing lets you recreate how a request is done, often through multiple services. Oftentimes, this is done on application-level.
- Knowing the resource consumption is good for assessing whether the application is ready. Examples include monitoring the CPU and memory consumption during a service and creating benchmarks.
For easier memorizing, we can use the phrase "A healthy metric of logs traces resource consumption."
If you're deploying a web application, for example, you may assign certain routes for some of the above practices — e.g., /status/
for health checks, /metrics/
to create a metrics dashboard.
Cloud Native Computing Foundation
Front
What is the Cloud Native Computing Foundation (CNCF) do and how do they contribute?
Back
CNCF is an organization that spearheads the development of cloud computing. It hosts and manages a plethora of cloud-related projects representing a whole suite of tools needed for cloud computing management. As of 2021-06-09, CNCF managed some of the popular cloud-related tools of today like Prometheus (metrics), Kubernetes (orchestration), containerd (container runtime), Jaeger (tracing), among others.
Container workflow
Front
Summarize the workflow of using containers with a container engine (e.g., Docker, Podman).
Back
- Create a file containing instructions how to build an image.
- Build the actual image with the container engine (e.g., Docker, Podman) and the instruction file (e.g., Dockerfile, Buildpack).
- Create a container from the image running the application.
- If successfully created one, you can publish the image in a registry (e.g., docker.io).
Kubernetes resources
Front
List the resources Kubernetes manages in a cluster.
Back
- Pod is a group of containers that run on nodes.
- Node is a representation of a computer. This may be a physical or a virtual computer to run multiple pods at a time.
- Deployment contains the state of the pods.
- Replica set ensures the pod is running at any given time by creating a set of identical pod.
- Service creates a single point for pods.
- Ingress lets an external user access to the cluster, typically using HTTP.
- ConfigMap manages the secrets of a cluster.
- Namespaces create separation between applications.
For easier memorizing, think of the name "DR SICPNN".
Take note it is not an exhaustive list as it usually manages more than 10 resources.
You can see what Kubernetes handle with the api-resource
subcommand.
Kubernetes external user access
Front
Since nodes in a Kubernetes cluster are normally accessed only within, is third-party access possible?
Back
Kubernetes ingress is exactly built for that purpose. It mainly does the job by exposing a resource through HTTP.
For example, if you have an application that is normally opens an HTTP server at port 5000, you can expose the application with the following command.
Assuming the application came from an image and deployed through Kubernetes (with the deployment name hello-ports
).
kubectl expose deployment hello-ports --port=5000 --target-port=5000
This will create a service that exposes the application to the outside.
Platform mechanisms
Front
What are the components to manage a cloud application?
Back
- Networking connects between other hardware.
- Storage provides a place to store data.
- Servers makes up the hardware to do its computational capabilities.
- Operating system is the software to connect with the hardware.
- Virtualization abstracts servers by emulating other systems (e.g., Ubuntu, Manjaro, Windows Server).
- Middleware provides a way to consume platform capabilities (e.g., messaging, API).
- Runtime provides the environment of the application.
- Data is where application-related data are stored.
- Application, where the business logic is.
Platform mechanisms: business models
Front
What are the different business models that make up the platform mechanisms?
Back
- On-premises simply lets the organization full control of the stack with their own physical location, establishment and everything.
- Infrastructure as a Service (IaaS) reduces the physical location. Though, it lets their customers control the software of the servers with their clusters. Usually in this model, they let you install a cluster management system like Kubernetes. Examples include Google Cloud Platform, Amazon Web Services, and Microsoft Azure.
- Platform as a Service (PaaS) further reduces the components into letting you manage only the application and the data. Examples include Heroku and Google App Engine.
- Function as a Service (FaaS) only lets their customers access the application. Usually, it is activated on-demand and involves being serverless. Examples include Amazon Lambda, Netlify Functions, and Google Cloud Functions.
Linux kernel options
Front
How to know what kernel options has been compiled for a Linux kernel?
Back
You can know what options has been compiled by looking at /proc/config.gz
.
However, it is only possible when compiled with CONFIG_IKCONFIG_PROC
option.
Here's an example how to know it on your shell right away.