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 | |
from wagtail.core.fields import RichTextField | |
from wagtail.core.models import Page | |
class BlogPost(Page): | |
body = RichTextField() | |
images = models.ManyToManyField('wagtailimages.Image') | |
def save(self, *args, **kwargs): |
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 Cookies from 'universal-cookie' | |
// Get Django cross site request forgery cookie for API requests. | |
const getCSRF = () => new Cookies().get('csrftoken') | |
// HTTP helper functions. | |
const http = { | |
// POST a JSON to URL (create new resource) | |
post: (url, data) => | |
fetch(url, { |
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
.custom-form, form { | |
max-width: 800px; | |
margin: 0 auto; | |
} | |
#sub-container { | |
padding-top: 3rem !important; | |
} | |
#left-sidebar { |
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 cerberus import Validator | |
ENV_CHOICES = ("aws", "desktop", "laptop") | |
CONFIG_SCHEMA = { | |
"runtime": { | |
"type": "dict", | |
"schema": {"cuda": {"type": "boolean", "required": True, "nullable": False},}, | |
}, | |
"logging": { | |
"type": "dict", |
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
# Training config | |
runtime: | |
cuda: true | |
logging: | |
# Logging to Weights and Bias dashboard | |
wandb: | |
project_name: null | |
# Saving checkpoint to S3 | |
checkpoint: | |
save_name: null |
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
runtime: | |
type: dict | |
schema: | |
cuda: | |
type: boolean | |
required: true | |
nullable: false | |
logging: | |
type: dict |
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
""" | |
Synthesizes speech from the input string of text. | |
from reader.services.translate.polly import text_to_speech_mp3 | |
reading = Reading.objects.last() | |
with open('./test.mp3', 'wb') as f: | |
text_to_speech_mp3(reading, f) | |
""" | |
from io import BytesIO | |
import boto3 |
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 React, { useState } from 'react' | |
import Header from './components/Header.js' | |
import Game from './components/Game.js' | |
import LeaderBoard from './components/LeaderBoard.js' | |
import Spinner from './components/Spinner.js' | |
// Don't hardcode strings, use constants | |
const DEFAULT_NAME = 'jeff' | |
export default function App(){ |
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 React, { useState } from 'react' | |
import Header from './components/Header.js' | |
import Game from './components/Game.js' | |
import LeaderBoard from './components/LeaderBoard.js' | |
import Spinner from './components/Spinner.js' | |
// Don't hardcode strings, use constants | |
const DEFAULT_NAME = 'jeff' | |
export default function App(){ |
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
### Virtual Host Config | |
## HTTP Redirects | |
server { | |
listen 80; | |
listen [::]:80; | |
server_name www.mattslinks.xyz; | |
return 301 http://mattslinks.xyz$request_uri; | |
} | |
server { |