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
function deletePopup() { | |
// check if the backdrop exists | |
var dialogBox = document.getElementsByClassName("gwt-DialogBox"); | |
if (dialogBox.length != 0) { | |
dialogBox = dialogBox[0]; | |
// if backdrop exists, check if message matches "have you spoken..." | |
caption = dialogBox.getElementsByClassName("Caption")[0].innerHTML; | |
if (caption == "Have You Spoken to Your Advisor?") { | |
// remove!!!!!!!! | |
dialogBox.parentNode.removeChild(dialogBox); |
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
{ | |
"name": "ISpokeToMyAdvisor", | |
"version": "1.0", | |
"description": "Hide the \"Have you spoken to your advisor?\" message on SIO.", | |
"permissions": ["activeTab"], | |
"content_scripts": [ | |
{ | |
"matches": ["https://s3.andrew.cmu.edu/*"], | |
"js": ["deleter.js"] | |
} |
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
const assert = require('assert'); | |
const Pool = require('pg').Pool; | |
const pool = new Pool({ | |
user: 'me', | |
host: 'localhost', | |
database: 'urlmem', | |
password: 'password', | |
port: 5432, | |
}); |
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
/* | |
* Create a shortening and return the shorturl if successful. Returns null if | |
* the shorturl already exists and is not the requested shortening, or if the | |
* longurl already has a random shortening and this shortening is also random. | |
* | |
* May throw other db errors. | |
*/ | |
const addShortening = async (shortUrl, longUrl, isRandom) => { | |
let addShorteningQuery = 'INSERT INTO shortenings (shorturl, longurl, israndom) VALUES ($1, $2, $3)'; |
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 create_stylized_image(decoder, content_features, style_features): | |
stylized_content_features = adain(content_features[-1], style_features[-1]) | |
stylized_image = decoder(stylized_content_features) | |
return stylized_image, stylized_content_features |
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 get_batch_style_transfer_loss(encoder, decoder, style_image, content_image): | |
style_features = encoder(style_image) | |
content_features = encoder(content_image) | |
stylized_image, stylized_features = create_stylized_image(decoder, content_features, style_features) | |
features_of_stylized = encoder(stylized_image) | |
style_loss = compute_style_loss(features_of_stylized, style_features) | |
content_loss = compute_content_loss(features_of_stylized, stylized_features) |
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 selenium.webdriver.support import expected_conditions as EC | |
from selenium import webdriver | |
from selenium.common.exceptions import NoSuchElementException | |
from selenium.webdriver.chrome.options import Options | |
from selenium.webdriver.support import expected_conditions as EC | |
from selenium.webdriver.common.by import By | |
from selenium.webdriver.support.ui import WebDriverWait | |
def login_to_autolab(wd, username, password): | |
wd.get("https://autolab.andrew.cmu.edu") |
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 IterableStyleTransferDataset(IterableDataset): | |
def __init__(self, coco_path, coco_annotations, \ | |
wiki_path, length = 100000, transform = None, rng_seed = 1, exclude_style = False): | |
self.wiki = ImageFolder(wiki_path, transform = transform) | |
self.coco = CocoCaptions(coco_path, coco_annotations, transform = transform) | |
self.length = length | |
self.exclude_style = exclude_style | |
self.seed = rng_seed |
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 get_transforms(crop): | |
if crop: | |
return Compose([Resize(512), RandomCrop(256), ToTensor()]) | |
return Compose([Resize((256, 256)), ToTensor()]) |
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 main(): | |
transforms = get_transforms() | |
dataset = StyleTransferDataset("datasets/coco/train2017", "datasets/coco/annotations/captions_train2017.json", "datasets/wikiart", transform = transforms) | |
print(f"Dataset length: {len(dataset)}, Wiki length: {len(dataset.wiki)}, COCO length: {len(dataset.coco)}") | |
content, style = dataset[0] | |
print(f"1st content img: {type(content)}, {content.shape}") | |
print(f"1st style img: {type(style)}, {style.shape}") |