Skip to content

Instantly share code, notes, and snippets.

View dhirschfeld's full-sized avatar

Dave Hirschfeld dhirschfeld

View GitHub Profile
@tomchristie
tomchristie / proxy.py
Created January 15, 2020 13:06
An ASGI proxy service.
import httpx
from starlette.requests import Request
from starlette.responses import StreamingResponse
class Proxy:
def __init__(self, hostname):
self.hostname = hostname
self.client = httpx.AsyncClient()
@meziantou
meziantou / ObjectDataReader.cs
Created February 1, 2017 00:28
ObjectDataReader (BulkInsert)
public class ObjectDataReader<T> : DbDataReader
{
private IEnumerator<T> _iterator;
private IDictionary<string, int> _propertyNameToOrdinal = new Dictionary<string, int>();
private IDictionary<int, string> _ordinalToPropertyName = new Dictionary<int, string>();
private Func<T, object>[] _getPropertyValueFuncs;
public ObjectDataReader(IEnumerator<T> items)
{
_iterator = items ?? throw new ArgumentNullException(nameof(items));