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
$url = "https://s3.amazonaws.com/assets-cp/assets/Agent_Uninstaller.zip" | |
$output = "C:\Windows\Temp\Agent_Uninstaller.zip" | |
(New-Object System.Net.WebClient).DownloadFile($url, $output) | |
# The below usage of Expand-Archive is only possible with PowerShell 5.0+ | |
# Expand-Archive -LiteralPath C:\Windows\Temp\Agent_Uninstaller.zip -DestinationPath C:\Windows\Temp\LTAgentUninstaller -Force | |
# Use .NET instead | |
[System.Reflection.Assembly]::LoadWithPartialName("System.IO.Compression.FileSystem") | Out-Null | |
# Now we can expand the archive | |
[System.IO.Compression.ZipFile]::ExtractToDirectory('C:\Windows\Temp\Agent_Uninstaller.zip', 'C:\Windows\Temp\LTAgentUninstaller') | |
Start-Process -FilePath "C:\Windows\Temp\LTAgentUninstaller\Agent_Uninstall.exe" |
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
param([string]$username='LocalAdministrator',[string]$password='P@ssw0rd!') | |
$secure_password = $password | ConvertTo-SecureString -AsPlainText -Force | |
try { | |
$LocalUserObject = Get-LocalUser -Name $username -ErrorAction Stop | |
} | |
catch [Microsoft.PowerShell.Commands.UserNotFoundException] { | |
"User $($username) Not Found" | Write-Warning | |
} |
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
package main | |
import ( | |
"fmt" | |
"io" | |
"net/http" | |
"os" | |
) | |
// DownloadFile will download a url to a local file. |
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
from typing import List | |
def twoSum(nums: List[int], target: int) -> List[int]: | |
answers = [] | |
for n in nums: | |
answers.append(target - n) | |
ans = set(answers) & set(nums) | |
return ans | |
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
import json | |
from datetime import * | |
import pprint | |
from dateutil.relativedelta import * | |
from dateutil.parser import * | |
import requests | |
import pytz | |
EASTERN_TZ = pytz.timezone('US/Eastern') |
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
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"] |
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
# 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 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
# 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 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
# 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) |