This file contains 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
# https://leetcode.com/problems/missing-number/ | |
import random | |
def generate_input_array(n: int) -> list: | |
if not (1 <= n <= 104): | |
raise ValueError('Given `n` does not fulfill 1 <= n <= 104') | |
nums = list() | |
while len(nums) != n: | |
temp = random.randint(0, n) |
This file contains 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
# Link: https://leetcode.com/explore/challenge/card/february-leetcoding-challenge-2021/584/week-1-february-1st-february-7th/3629/ | |
# Given a string path, which is an absolute path (starting with a slash '/') to a file or directory in a Unix-style file system, convert it to the simplified canonical path. | |
# In a Unix-style file system, a period '.' refers to the current directory, a double period '..' refers to the directory up a level, and any multiple consecutive slashes (i.e. '//') are treated as a single slash '/'. For this problem, any other format of periods such as '...' are treated as file/directory names. | |
# The canonical path should have the following format: | |
# The path starts with a single slash '/'. | |
# Any two directories are separated by a single slash '/'. | |
# The path does not end with a trailing '/'. |
This file contains 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
#include <iostream> | |
static int outside_variable{0}; | |
class Demo { | |
int val; | |
public: | |
static const int inside{1}; | |
Demo(int v = 0) { | |
val = v; |
This file contains 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
from typing import List | |
class Solution: | |
def binary_search(self, container: List[int], key): | |
low = 0 | |
high = len(container) - 1 | |
while (low <= high): | |
middle = (low + high) >> 1 | |
middle_value = container[middle] | |
if middle_value < key: |
This file contains 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
Link: https://leetcode.com/problems/ransom-note/ | |
Given an arbitrary ransom note string and another string containing letters from all the magazines, | |
write a function that will return true if the ransom note can be constructed from the magazines; | |
otherwise, it will return false. | |
Each letter in the magazine string can only be used once in your ransom note. | |
Example 1: | |
Input: ransomNote = "a", magazine = "b" |
This file contains 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
# https://leetcode.com/problems/missing-number/ | |
import random | |
def generate_input_array(n: int) -> list: | |
if not (1 <= n <= 104): | |
raise ValueError('Given `n` does not fulfill 1 <= n <= 104') | |
nums = list() | |
while len(nums) != n: | |
temp = random.randint(0, n) |
This file contains 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
# Generate Report of BitLocker Status for Computers in the BitLocker Machines OU. | |
# Sources: https://4sysops.com/archives/find-bitlocker-recovery-passwords-in-active-directory-with-powershell/ | |
param([string]$OutputDirectory="~/Desktop",[string]$OrganizationalUnit=([adsi]'').distinguishedName) | |
if(!([Security.Principal.WindowsPrincipal] ` | |
[Security.Principal.WindowsIdentity]::GetCurrent() ` | |
).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { | |
Write-Host -ForegroundColor Yellow "Only Administrators can read BitLocker Recovery Keys." | |
exit | |
} | |
$computers = Get-ADComputer -Filter * -SearchBase $OrganizationalUnit |
This file contains 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
# Generate Report of BitLocker Status for Computers in the BitLocker Machines OU. | |
param([string]$OutputDirectory="~/Desktop",[string]$OrganizationalUnit=([adsi]'').distinguishedName) | |
if(!([Security.Principal.WindowsPrincipal] ` | |
[Security.Principal.WindowsIdentity]::GetCurrent() ` | |
).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { | |
Write-Host -ForegroundColor Yellow "Only Administrators can read BitLocker Recovery Keys." | |
exit | |
} | |
$computers = Get-ADComputer -Filter * -SearchBase $OrganizationalUnit | |
$results = ForEach ($computer in $computers) { |
This file contains 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
FROM python:3.7-slim | |
COPY contained /src/app/contained | |
WORKDIR /src/app | |
RUN pip install Flask | |
ENV FLASK_APP contained | |
CMD ["flask", "run", "--host=0.0.0.0"] |
NewerOlder