Skip to content

Instantly share code, notes, and snippets.

from graphene_pydantic import PydanticObjectType
class GraphQLFlight(PydanticObjectType):
class Meta:
model = Flight
type Flight {
origin: String
destination: String
departure: DateTime
}
In [0]: Flight(origin="DCA", destination="ORD", departure="hurrah")
ValidationError: 1 validation error
departure
invalid datetime format (type=type_error.datetime)
from datetime import datetime
from pydantic import BaseModel
class Flight(BaseModel):
origin: str
destination: str
departure: datetime
@necaris
necaris / couchdb2cb.py
Last active December 2, 2017 09:55
Simple script to transfer data from CouchDB to Couchbase
#-*-coding: utf-8-*-
"""
Simple script to dump documents out of a CouchDB database and straight into
a Couchbase instance.
"""
import time
import sys
import argparse
#!/usr/bin/env python
#-*-coding: utf-8-*-
"""
Simple script to dump documents out of a CouchDB database and straight into
a Couchbase instance.
"""
# Copyright (c) 2013, Rami Chowdhury
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#!/usr/bin/env python
#-*-coding: utf-8-*-
"""
Fake CouchDB replication endpoint that copies documents into Couchbase.
"""
# Copyright (c) 2013, Rami Chowdhury
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
$ ping www.google.com.bd
PING www.google.com.bd (74.125.135.94): 56 data bytes
64 bytes from 74.125.135.94: icmp_seq=0 ttl=45 time=359.124 ms
64 bytes from 74.125.135.94: icmp_seq=1 ttl=45 time=904.636 ms
Request timeout for icmp_seq 2
64 bytes from 74.125.135.94: icmp_seq=3 ttl=45 time=674.531 ms
Request timeout for icmp_seq 4
64 bytes from 74.125.135.94: icmp_seq=5 ttl=45 time=623.437 ms
Request timeout for icmp_seq 6
Request timeout for icmp_seq 7
@necaris
necaris / latency.txt
Created May 31, 2012 13:11 — forked from jboner/latency.txt
Latency numbers every programmer should know
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns
Mutex lock/unlock 25 ns
Main memory reference 100 ns
Compress 1K bytes with Zippy 3,000 ns
Send 2K bytes over 1 Gbps network 20,000 ns
Read 1 MB sequentially from memory 250,000 ns
Round trip within same datacenter 500,000 ns
Disk seek 10,000,000 ns
@necaris
necaris / maven-output.txt
Created April 29, 2012 17:05
Maven Output
Downloading: http://download.java.net/maven/2/net/java/jvnet-parent/1/jvnet-parent-1.pom
[INFO] Unable to find resource 'net.java:jvnet-parent:pom:1' in repository m2.java.net (http://download.java.net/maven/2)
Downloading: http://repository.jboss.org/nexus/content/groups/public//net/java/jvnet-parent/1/jvnet-parent-1.pom
[INFO] Unable to find resource 'net.java:jvnet-parent:pom:1' in repository repository.jboss.org (http://repository.jboss.org/nexus/content/groups/public/)
Downloading: http://maven.glassfish.org/content/groups/glassfish/net/java/jvnet-parent/1/jvnet-parent-1.pom
185b downloaded (jvnet-parent-1.pom)
[WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = '6c9fd3d150b8a5f0ca676f49b8ed603793cabebb'; remote = '<html>
<head><title>301' - RETRYING
Downloading: http://maven.glassfish.org/content/groups/glassfish/net/java/jvnet-parent/1/jvnet-parent-1.pom
185b downloaded (jvnet-parent-1.pom)