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
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
/* | |
* 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
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
{ | |
"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
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
#.env | |
GENERATE_SOURCEMAP=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
// GET route for custom URLs | |
app.get('/custom', (req, res) => { | |
// sanitize input | |
if (typeof (req.query.longUrl) !== "string" || | |
typeof (req.query.customUrl) !== "string") { | |
res.send({"shortened": null}); | |
return; | |
} | |
let longUrl = qualify(req.query.longUrl); |
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
renderOutputs() { | |
return ( | |
<TransitionGroup> | |
{this.state.shortenedUrls.map(UrlPair => | |
<CSSTransition | |
key={UrlPair.id} | |
timeout={300} | |
classNames='latestOut' | |
> | |
<UrlOutput longUrl={UrlPair.longUrl} |
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
#!/usr/bin/env bash | |
# clone vim and vundle | |
cd ~ | |
git clone https://github.com/vim/vim.git | |
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim | |
# build vim | |
cd vim | |
git checkout a21df1db3ca619afdcb47931af042508a6bbc8e5 |