This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ApiController] | |
[Route("[controller]")] | |
public class HealthCheckController : ControllerBase | |
{ | |
private readonly ILogger<HealthCheckController> _logger; | |
public HealthCheckController(ILogger<HealthCheckController> logger) | |
{ | |
_logger = logger; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ApiController] | |
[Route("[controller]")] | |
public class HealthCheckController : ControllerBase | |
{ | |
private readonly ILogger<HealthCheckController> _logger; | |
public HealthCheckController(ILogger<HealthCheckController> logger) | |
{ | |
_logger = logger; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# We use the alpine as base image | |
FROM mcr.microsoft.com/dotnet/aspnet:5.0-alpine-amd64 | |
# Perform the health check call via curl | |
HEALTHCHECK --interval=5s --timeout=3s CMD curl --fail http://localhost/healthcheck || exit 1 | |
RUN apk --update --no-cache add curl | |
# Create a group and usermcr.microsoft.com/dotnet/runtime | |
RUN addgroup --gid 1000 -S app && adduser --uid 1000 -S app -G app |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program | |
{ | |
static async Task Main(string[] args) | |
{ | |
AppDomain.CurrentDomain.ProcessExit += (_, _) => | |
{ | |
Console.WriteLine("Received SIGTERM"); | |
}; | |
Console.CancelKeyPress += (_, _) => |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# We use the alpine as base image | |
FROM mcr.microsoft.com/dotnet/runtime:5.0-alpine-amd64 | |
# Create a group and user | |
RUN addgroup --gid 1000 -S app && adduser --uid 1000 -S app -G app | |
# Create the work dir and set permissions as WORKDIR set the permissions as root | |
RUN mkdir /home/app/net && chown -R app:app /home/app/net | |
WORKDIR /home/app/net |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def calculate_rotation(self, previous_point, current_point): | |
dx = current_point.xpos - previous_point.xpos | |
dy = current_point.ypos - previous_point.ypos | |
return math.degrees(math.atan2(dx, dy)) + 180 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def enemy_shoots(self): | |
nr_of_enemies = len(self.all_enemies) | |
if nr_of_enemies > 0: | |
enemy_index = random.randint(0, nr_of_enemies - 1) | |
start_rocket = None | |
for index, enemy in enumerate(self.all_enemies): | |
if index == enemy_index: | |
start_rocket = enemy.rect.center | |
if start_rocket[1] < 400: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class StarField(): | |
def __init__(self): | |
self.star_field_slow = self.create_stars(50) | |
self.star_field_medium = self.create_stars(35) | |
self.star_field_fast = self.create_stars(30) | |
def create_stars(self, number_of_stars): | |
stars = [] | |
for _ in range(number_of_stars): | |
star_loc_x = random.randrange(0, constants.SCREEN_WIDTH) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ControlHandlerMover(): | |
def __init__(self, | |
control_point_quartet_collection: ControlPointQuartetCollection, | |
path_point_selector: PathPointSelector): | |
self.control_point_quartet_collection = control_point_quartet_collection | |
self.path_point_selector = path_point_selector | |
def move_control_handler(self, control_point_handler: ControlPointHandler, x: int, y: int): | |
dx = self.control_point_quartet_collection.get_control_point(control_point_handler).x - x | |
dy = self.control_point_quartet_collection.get_control_point(control_point_handler).y - y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PathPointCalculator(): | |
@staticmethod | |
def calculate_path_point(control_point_quartet: ControlPointQuartet, | |
time_to_calculate: float): | |
time: float = time_to_calculate - int(time_to_calculate) | |
cx: float = 3.0 * (control_point_quartet.get_point(1).x - | |
control_point_quartet.get_point(0).x) | |
cy: float = 3.0 * (control_point_quartet.get_point(1).y - |