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 pulp, csv | |
| # Conversion factors | |
| in_to_mm = 25.4 # 1 inch is 25.4 mm | |
| # Define the stock boards as a list of tuples (description, length in mm, width in mm, cost) | |
| # All lengths are converted to mm (1 ft = 12 in) | |
| # Conversion factors | |
| in_to_mm = 25.4 # 1 inch = 25.4 millimeters |
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
| public class PigLatinConverter { | |
| public static void main(String[] args) { | |
| String inputSentence = "Hello world this is a test"; | |
| String pigLatinSentence = convertSentenceToPigLatin(inputSentence); | |
| System.out.println("Original: " + inputSentence); | |
| System.out.println("Pig Latin: " + pigLatinSentence); | |
| } | |
| public static String convertSentenceToPigLatin(String sentence) { |
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 __future__ import print_function | |
| import base64 | |
| import os | |
| import os.path | |
| import sys | |
| import email | |
| import datetime | |
| import pytz | |
| import base64 | |
| import email |
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 __future__ import print_function | |
| import base64 | |
| import os | |
| import os.path | |
| from google.auth.transport.requests import Request | |
| from google.oauth2.credentials import Credentials | |
| from google_auth_oauthlib.flow import InstalledAppFlow | |
| from googleapiclient.discovery import build | |
| from googleapiclient.errors import HttpError | |
| import sys |
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 matplotlib.pyplot as plt | |
| import matplotlib.patches as patches | |
| def first_fit_decreasing(pieces, plywood_width, plywood_length): | |
| pieces = sorted(pieces, key=lambda x: x[0] * x[1], reverse=True) | |
| bins = [] | |
| positions = [] | |
| for piece in pieces: | |
| piece_placed = False |
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 bs4 import BeautifulSoup | |
| import csv | |
| import re | |
| with open('edmunds.html', 'r') as f: | |
| html = f.read() | |
| soup = BeautifulSoup(html, 'html.parser') | |
| results = [] |
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 bs4 import BeautifulSoup | |
| import csv | |
| import re | |
| with open('output.html', 'r') as f: | |
| html = f.read() | |
| soup = BeautifulSoup(html, 'html.parser') | |
| results = [] |
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
| #!/bin/zsh | |
| input_file="$1" | |
| output_file="output.html" | |
| # Remove <img> tags with optional whitespace before and after the tag | |
| sed -e 's/[[:space:]]*<img[^>]*>[[:space:]]*//g' "$input_file" > "$output_file" | |
| # Remove <g-img> tags with optional whitespace before and after the tag | |
| sed -i.bak -e 's/[[:space:]]*<g-img[^>]*>[[:space:]]*//g' "$output_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 bs4 import BeautifulSoup | |
| import csv | |
| import re | |
| with open('data.html', 'r') as f: | |
| html = f.read() | |
| soup = BeautifulSoup(html, 'html.parser') | |
| results = [] |
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 bs4 import BeautifulSoup | |
| with open('data.html', 'r') as f: | |
| html = f.read() | |
| soup = BeautifulSoup(html, 'html.parser') | |
| results = [] | |
| for result_tile in soup.find_all('div', {'data-qa': 'result-tile'}): |