In this article, we will create a minimal Spring Boot application that uses GitHub for authentication.
OAuth is an open-source standard for access delegation. It grants applications access to users' protected resources via an authorization server.
For example, let’s suppose you’re developing a code scanning application, and you want to get access to users’ code on GitHub. Asking users for their credentials is not a realistic solution — no one will ever share sensitive data with you. This where OAuth comes in. Using the OAuth authorization mechanism, services can authorize against each other on the user’s behalf:
Problem: Given a positive integer, write a code to find if it is a power of two or not.
“A number is a power of two” means that it can be written as 2^x where x is an integer. For example:
The immediate solution: Take the log of the given number on base 2 and if you get an integer then the number is the power of two. …
Let’s begin by creating a minimal Flask application:
Next, let’s write the command that will run the Gunicorn server:
The parameters are pretty much self-explanatory: We are telling Gunicorn that we want to spawn two worker processes running two threads each. We are also accepting connections from the outside and overriding Gunicorn’s default port (8000).
Our basic Dockerfile:
Let’s build our image:
docker build -t flask/hello-world .
docker run -p 8003:8003 flask/hello-world
The application is now accessible since we published the port:
$ curl localhost:8003
Assuming you already have Minikube running on your machine, follow the steps below. …
“git-bisect — Use binary search to find the commit that introduced a bug” — Git’s official docs
It’s best to go through a real example in order to understand this command and demonstrate how it works.
Let’s create an empty Git project and add the following commits:
git commit --allow-empty -m 'good commit 1'
git commit --allow-empty -m 'good commit 2'
git commit --allow-empty -m 'good commit 3'
git commit --allow-empty -m 'good commit 4'
git commit --allow-empty -m 'good commit 5'
git commit --allow-empty -m 'good commit 6'
git commit --allow-empty -m 'BAD COMMIT'
git commit --allow-empty -m 'good commit 7'
git commit --allow-empty -m 'good commit 8'
git commit --allow-empty -m 'good commit 9'
git commit --allow-empty -m 'good commit…
Computers have their own language. They don’t understand human languages (maybe they do if you speak binary), and they don’t know anything but binary. How do we communicate with them?
As I’m typing now, the computer is not aware of any of the characters you’re seeing. Let’s consider the M character. At the lowest level, M is stored using a sequence of 0s and 1s:
01001101. Before we proceed, let’s recall two fundamental definitions:
Bit — smallest unit of storage, can only store 0 or 1
Byte — one byte = eight bits. That’s it.
“The Unicode Standard is a character coding system designed to support the worldwide interchange, processing, and display of the written texts of the diverse languages and technical disciplines of the modern world. In addition, it supports classical and historical texts of many written languages.” …
It is literally true that you can succeed best and quickest by helping others to succeed — Napoleon Hill
If you’ve ever been interested in programming or anything related to and been around the net long enough, you’ve come across Stack Overflow, accidentally or on purpose.
What is Stack Overflow?
Stack Overflow is a question and answer site for professional and enthusiast programmers. It’s built and run by you as part of the Stack Exchange network of Q&A sites. With your help, we’re working together to build a library of detailed answers to every question about programming.
It was in 2013 when I asked my first question in Stack Overflow, got heavily down-voted and my question was closed. Back then, I didn’t know why was that 🤷♂️. All that I asked for was a solution for my homework, and by saying “solution” I mean a full solution. I didn’t expect comments…
If you’re using the command line to interact with your Kubernetes cluster, you’re probably familiar with the
There are many cheatsheets available for
kubectl that attempt to cover all of its available commands. While it’s very powerful, this command can be a bit cumbersome for some of the operations that you use on a daily basis. For example, the following command list contains only a small portion of the available commands of
│ └── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
│ └── depl.yaml
App.java is the entry point of the application:
The code above contains the minimal lines needed to create a Spring Boot application.
HelloWorldCtrl.java contains a simple controller that maps the root path
(“/”) and returns a greeting String:
I’m using Gradle as my build tool. The
build.gradle file is also minimal and consists of the following lines:
id 'org.springframework.boot' version '2.3.3.RELEASE'
id 'io.spring.dependency-management' version '1.0.8.RELEASE'
group = 'com.test'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
implementation 'org.springframework.boot:spring-boot-starter-web' …
If you look at the
Dockerfile reference, some instructions might seem overlapping at first glance, or sometimes even redundant. For example, both
COPY copy new files or directories to the filesystem of the container.
In this article, I’ll explain the difference between the even more confusing instructions
Let’s suppose we want to create an Ubuntu image whose only purpose is to run a
sleep command when it starts. We’ll create our own image and specify a new command:
CMD sleep 10
Now, we build and run the image:
docker build -t custom_sleep .
docker run custom_sleep
# sleep for 10 seconds and…
In this article, we’ll dive into Git internals by going through a real example. If you don’t have your terminal open already, do so, fasten your seatbelts, and let’s go!
You have probably already initialized an empty Git project using
git init, but have you ever wondered what this command does?
Let’s create an empty folder and initialize an empty Git project. This is how the official Git documentation describes
“This command creates an empty Git repository — basically a
.gitdirectory with subdirectories for
refs/tags, and template files. …