I hereby claim:
- I am powerman on github.
- I am powerman (https://keybase.io/powerman) on keybase.
- I have a public key ASCSBOCcVZFOBR0em9fFkAAWPJX7QbEQq69BY9wDKS_n2Qo
To claim this, I am signing this object:
use AnyEvent; | |
sub allow_non_blocking_cgi { | |
my ($module) = @_; | |
eval "require $module;" or die $@; ## no critic (ProhibitStringyEval) | |
my $startup = \&{$module.'::startup'}; | |
my $wrapper = sub { | |
my ($app) = @_; | |
&{$startup}; | |
my $done = AnyEvent->condvar; |
I hereby claim:
To claim this, I am signing this object:
// Package tail implements behaviour of `tail -n 0 -F path`. | |
package tail | |
import ( | |
"time" | |
) | |
var ( | |
pollDelay = 200 * time.Millisecond // delay between polling to save CPU | |
pollTimeout = time.Second // how long to wait before returning os.ErrNotExist |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta name="viewport" content="width=device-width" /> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<title>{{ template "__subject" . }}</title> | |
</head> | |
<body itemscope itemtype="http://schema.org/EmailMessage"> |
package expdelay | |
import "time" | |
// ExpDelay implements exponential delay. | |
type ExpDelay struct{ cur, max time.Duration } | |
// New returns new exponential delay which start with min delay, increase | |
// each next delay in 2 times up to max delay. | |
// |
func BenchmarkJSON(b *testing.B) { | |
for i := 0; i < b.N; i++ { | |
obj := Object{} | |
if err := json.Unmarshal(testCase, &obj); err != nil { | |
b.Fatal(err) | |
} | |
} | |
} | |
func BenchmarkFastJSON(b *testing.B) { |
--- /tmp/westmore.flags 2020-05-30 12:25:20.909340358 +0300 | |
+++ /tmp/haswell.flags 2020-05-30 12:25:34.182340758 +0300 | |
+abm | |
-aes | |
+cpuid_fault | |
-dca | |
+ept_ad | |
+erms | |
+fsgsbase | |
-ida |
use AnyEvent::DBI::MySQL; | |
sub startup { | |
my $app = shift; | |
$app->config(db => {dsn=>…, login=>…, pass=>…}); | |
$app->helper(dbh => sub { shift->{dbh} }); | |
$app->helper(new_dbh => sub { | |
state $db = shift->app->config('db') or return; |
// Usage example: | |
func process(in <-chan Msg, outBlocking chan<- Msg) { | |
out := newQueueMsg(QueueSize, outBlocking) | |
for { | |
select { | |
case msg := <-in: | |
out.append(msg) | |
case out.C <- out.Elem: | |
out.del() | |
} |