Skip to content

Instantly share code, notes, and snippets.

@theCompanyDream
Last active February 20, 2025 20:52
Show Gist options
  • Save theCompanyDream/e7a63b9cb68493cd4998b0ffc72267b4 to your computer and use it in GitHub Desktop.
Save theCompanyDream/e7a63b9cb68493cd4998b0ffc72267b4 to your computer and use it in GitHub Desktop.
SWE Contractor test
from bs4 import BeautifulSoup
import requests
def find_files(url):
soup = BeautifulSoup(requests.get(url).text, 'html.parser')
for a in soup.find_all('a'):
href = a.get('href')
# Check if href exists and does not end with a slash (i.e., it's likely a file)
if href and not href.endswith('/') and href != "../":
yield href
for file in find_files("https://gentoo.osuosl.org/distfiles/"):
print(file)
def longest_increasing_subsequence(nums):
if not nums:
return 0
n = len(nums)
dp = [1] * n # Every element is an increasing subsequence of length 1
for i in range(1, n):
for j in range(i):
if nums[i] > nums[j]:
dp[i] = max(dp[i], dp[j] + 1)
return max(dp)
# Example usage:
nums = [11, 5, 2, 5, 3, 7, 101, 18]
print(longest_increasing_subsequence(nums))
SELECT
image_id,
CASE
WHEN score >= 0.5 THEN 1 -- Strong label
ELSE 0 -- Weak label
END AS weak_label
FROM unlabeled_image_predictions
ORDER BY image_id;
#!/bin/bash
find . -maxdepth 1 -type f -name "*.txt" -mtime -30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment