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
# 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
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
.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
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
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
class ArticlePage(Page): | |
pass | |
class SectionPage(Page): | |
# ... | |
def route(self, request, path_components): | |
""" | |
Perform ORM optimisations on ArticlePage to speed up article load times | |
""" | |
try: |
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
# models.py | |
from wagtail.core.fields import RichTextField | |
from wagtail.core.models import Page | |
class MyModel(Page): | |
# ... | |
body = RichTextField(features=[ | |
# ... | |
'subscript', | |
'superscript', |
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 { Component } from 'react'; | |
const { AtomicBlockUtils, EditorState, SelectionState, Modifier } = window.DraftJS | |
// The source gathers data for new entities that are being added in the Draftail editor | |
// It is invoked only when an new embed is inserted by the user | |
export class TextSource extends Component { | |
componentDidMount() { | |
const { editorState, entityType, onComplete } = this.props; |
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 hashlib | |
user_password = 'hunter12' | |
database_password = '6618f892842dcbc32f7968cc8f73b5b0065ec04e' | |
salt = '#&@#DH@HDHUUS' | |
user_password_hashed = hashlib.sha1(user_password + salt).hexdigest() | |
print(user_password_hashed == user_password_hashed) |