The update_or_create
model function was updated in Django 5.0 with a create_defaults
argument that allows only used during create operations.
This file contains 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
""" | |
This module provides utilities for working with Moment.js date formats in | |
Python. | |
""" | |
import datetime | |
import re | |
from typing import Union | |
This file contains 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 dataclasses import asdict, is_dataclass | |
def merge_dataclasses(dataclass_a, dataclass_b): | |
""" | |
Merge two dataclasses into a new dataclass. | |
""" | |
if ( | |
is_dataclass(dataclass_a) is False | |
and is_dataclass(dataclass_b) is False |
> time go run cryptocoinmarketcap.go
2017/12/19 17:26:38 Scraping finished, check file "cryptocoinmarketcap-go.csv" for results
2.24 real 0.84 user 0.45 sys
> time python3 cryptocoinmarketcap.py
WARNING:root:Scraping finished, check file cryptocoinmarketcap-py.csv for results
3.51 real 2.94 user 0.07 sys
This file contains 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 python3 | |
import argparse | |
import math | |
import os.path | |
import pandas as pd | |
import numpy as np | |
def main(filepath): |
This file contains 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 datetime | |
from fabric.api import cd, env, task, run | |
from fabric.contrib.project import rsync_project | |
from fabric.utils import puts | |
env.hosts = ['127.0.0.1'] | |
env.user = 'serverpilot' | |
env.app_dir = '~/apps/laravel/' | |
env.releases_dir = '~/.releases/laravel' |
This file contains 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 datetime | |
import yaml | |
from ansible_vault.api import Vault | |
from fabric.api import env, execute, get, local, put, run, task | |
env.user = 'root' | |
env.now = datetime.datetime.now().strftime('%Y-%m-%dT%H-%M-%S') | |
env.roledefs = { |
This file contains 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 python3 | |
import argparse | |
def encode(secret): | |
binary = bin(int.from_bytes(secret.encode(), 'big')) | |
return binary[2:].replace('0', '❤️').replace('1', '💜') | |
def decode(code): |
This file contains 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 WordPress from 'wpcom'; | |
import { css } from 'glamor' | |
import React from 'react'; | |
let PostStyle = css({ | |
borderBottomColor: '#ccc', | |
borderBottomStyle: 'solid', | |
borderBottomWidth: '1px', | |
margin: '1em 0', |
This file contains 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
<html> | |
<head><title>Fuzzy Search</title> | |
<script id="algorithm"> | |
// YOUR CODE HERE ! | |
</script> |
NewerOlder