Skip to content

Instantly share code, notes, and snippets.

@hartator
hartator / gist:3b1ece1c2ff60f1610b1216c92e20239
Created April 16, 2020 21:01
.net error: System.Threading.Tasks.TaskCanceledException: The operation was canceled.
System.AggregateException: One or more errors occurred.
(System.Threading.Tasks.TaskCanceledException: The operation was canceled.
at System.Net.Http.ConnectHelper.ConnectAsync(String host,
Int32 port, CancellationToken cancellationToken)
at
System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage
request, Boolean allowHttp2, CancellationToken cancellationToken)
at
System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage
request, CancellationToken cancellationToken)
@hartator
hartator / dom-to-3d-view.js
Last active February 2, 2024 04:36
dom-to-3d-view.js
function domTo3DView(b, p) {
function l(k, c, b, e, g, d, f) {
return "<div style='position:absolute;-webkit-transform-origin: 0 0 0;" + ("background:" + f + ";") + ("width:" + e + "px; height:" + g + "px;") + ("-webkit-transform:" + ("translate3d(" + k + "px," + c + "px," + b + "px)") + ("rotateX(270deg) rotateY(" + d + "deg)") + ";") + "'></div>"
}
function o(k, c, d, f) {
for (var j = k.childNodes, n = j.length, m = 0; m < n; m++) {
var a = j[m];
if (1 === a.nodeType) {
a.style.overflow = "visible";
<!DOCTYPE html><html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:Web="http://schemas.live.com/Web/"><script type="text/javascript" >//<![CDATA[
si_ST=new Date
//]]></script><head><!--pc--><title>restaurant - Bing</title><meta content="text/html; charset=utf-8" http-equiv="content-type" /><meta name="referrer" content="origin-when-cross-origin" /><link href="/search?format=rss&amp;q=restaurant&amp;form=QBRE&amp;mkt=en-us" rel="alternate" title="XML" type="text/xml" /><link href="/search?format=rss&amp;q=restaurant&amp;form=QBRE&amp;mkt=en-us" rel="alternate" title="RSS" type="application/rss+xml" /><link href="/sa/simg/bing_p_rr_teal_min.ico" rel="shortcut icon" /><link href="/sa/simg/Roboto_Regular.woff2" rel="preload" type="font/woff2" as="font" crossorigin="anonymous" /><link href="/sa/simg/Roboto_Light.woff2" rel="preload" type="font/woff2" as="font" crossorigin="anonymous" /><link href="/sa/simg/Roboto_Semibold.woff2" rel="preload" type="font/woff2" as="font" crossorigin="anonymous"
<!DOCTYPE html><html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:Web="http://schemas.live.com/Web/"><script type="text/javascript" >//<![CDATA[
si_ST=new Date
//]]></script><head><!--pc--><title>pizza in Vegas - Bing</title><meta content="text/html; charset=utf-8" http-equiv="content-type" /><meta name="referrer" content="origin-when-cross-origin" /><link href="/search?format=rss&amp;form=QBLH&amp;pq=pizza+in+Vegas&amp;q=pizza+in+Vegas&amp;sc=1-19&amp;sp=-1" rel="alternate" title="XML" type="text/xml" /><link href="/search?format=rss&amp;form=QBLH&amp;pq=pizza+in+Vegas&amp;q=pizza+in+Vegas&amp;sc=1-19&amp;sp=-1" rel="alternate" title="RSS" type="application/rss+xml" /><link href="/sa/simg/bing_p_rr_teal_min.ico" rel="shortcut icon" /><link href="/sa/simg/Roboto_Regular.woff2" rel="preload" type="font/woff2" as="font" crossorigin="anonymous" /><link href="/sa/simg/Roboto_Light.woff2" rel="preload" type="font/woff2" as="font" crossorigin="anonymous" /><link href="/sa/simg/Roboto_Semibold.
➜ ~ ruby bench.rb
Insert
25.138513 3.058592 28.197105 ( 35.154406)
Read
61.040155 0.328887 61.369042 ( 63.799046)
Delete
0.001230 0.000049 0.001279 ( 0.772733)
require 'mongo'
require 'digest'
require 'benchmark'
Mongo::Logger.logger.level = Logger::WARN
client = Mongo::Client.new('mongodb://127.0.0.1:27017/test')
sleep 1
puts "Insert"
➜ ~ ruby bench.rb
Insert
24.042996 2.889875 26.932871 ( 34.179368)
Read
54.235487 0.366442 54.601929 ( 57.694639)
Delete
0.009912 0.000000 0.009912 ( 0.533347)
➜ ~ ruby bench.rb
Insert
40.532248 2.924545 43.456793 ( 54.666667)
Read
68.108048 0.554949 68.662997 ( 72.872750)
Delete
0.005216 0.000040 0.005256 ( 0.855717)
➜ ~ ruby bench.rb
Insert
40.193595 3.200520 43.394115 ( 54.046674)
Read
75.905196 0.467443 76.372639 ( 80.664453)
Delete
0.015227 0.000000 0.015227 ( 0.734783)
➜ ~ ruby bench.rb
Insert
26.174866 2.832391 29.007257 ( 36.463846)
Read
54.474455 0.491948 54.966403 ( 57.620262)
Delete
0.000908 0.000038 0.000946 ( 0.613453)