Skip to content

Instantly share code, notes, and snippets.

View oschaaf's full-sized avatar

Otto van der Schaaf oschaaf

View GitHub Profile
@oschaaf
oschaaf / gist:992d8a1adc2e386227ec
Last active August 29, 2015 14:16
testing psol request header input to options
import re
import pytest
import config
import test_helpers as helpers
filters = [
("add_instrumentation","ai"),
("canonicalize_javascript_libraries","ij"),
@oschaaf
oschaaf / Google Analytics C# MVC Local hosting snippet
Last active August 29, 2015 14:22
Google Analytics C# MVC Local hosting snippet
public class MvcApplication : System.Web.HttpApplication
{
private static object ga_lock_ = new {};
private static bool ga_refreshed_ = false;
private void Application_BeginRequest(object sender, EventArgs e)
{
if (!ga_refreshed_) {
lock(ga_lock_) {
Response.CacheControl = "public";
@oschaaf
oschaaf / tmp.cc
Last active November 27, 2015 19:10
cpp lazyinit
class EndToEndHeadersContainer {
public:
EndToEndHeadersContainer() {
// See http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.5.1
const int kReserveSize = 36;
int index = 0;
StringPieceVector names(kReserveSize);
names[index++] = StringPiece(HttpAttributes::kAccept);
names[index++] = StringPiece(HttpAttributes::kAcceptEncoding);
@oschaaf
oschaaf / nps_pos_aux.diff
Last active December 1, 2015 10:18
nps_pos_aux.diff
diff --git a/config b/config
index 848523c..9bd4a52 100644
--- a/config
+++ b/config
@@ -193,9 +193,8 @@ if [ $ngx_found = yes ]; then
$ps_src/ngx_server_context.cc \
$ps_src/ngx_url_async_fetcher.cc"
- # Make pagespeed run immediately before gzip.
- HTTP_FILTER_MODULES=$(echo $HTTP_FILTER_MODULES |\
@oschaaf
oschaaf / config
Created February 6, 2016 20:46
config for building ngx_pagespeed as a dynamic .so module
# Copyright 2012 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@oschaaf
oschaaf / error.log
Created April 13, 2016 11:49
nginx 1.9.14 rate limiting + http/2
2016/04/13 13:45:42 [debug] 27207#0: *2 SSL_write: 13
2016/04/13 13:45:42 [debug] 27207#0: *2 http2 frame sent: 0000000001E6DEC8 sid:0 bl:0 len:4
2016/04/13 13:45:42 [debug] 27207#0: *2 free: 0000000001E6DC70, unused: 3320
2016/04/13 13:45:42 [debug] 27207#0: *2 free: 0000000001EEF080
2016/04/13 13:45:42 [debug] 27207#0: *2 reusable connection: 1
2016/04/13 13:45:42 [debug] 27207#0: *2 event timer del: 9: 1460548122266
2016/04/13 13:45:42 [debug] 27207#0: *2 event timer add: 9: 180000:1460548122683
2016/04/13 13:45:42 [debug] 27207#0: timer delta: 417
2016/04/13 13:45:42 [debug] 27207#0: worker cycle
2016/04/13 13:45:42 [debug] 27207#0: epoll timer: 180000
@oschaaf
oschaaf / error.log
Created April 13, 2016 11:53
nginx 1.9.14 POST to non-existing url on http/2
2016/04/13 13:52:18 [debug] 27207#0: *82 post event 0000000001EBF120
2016/04/13 13:52:18 [debug] 27207#0: posted event 0000000001EBF120
2016/04/13 13:52:18 [debug] 27207#0: *82 delete posted event 0000000001EBF120
2016/04/13 13:52:18 [debug] 27207#0: *82 http2 handle connection handler
2016/04/13 13:52:18 [debug] 27207#0: *82 free: 0000000001E6DC70, unused: 3496
2016/04/13 13:52:18 [debug] 27207#0: *82 free: 0000000001EEF080
2016/04/13 13:52:18 [debug] 27207#0: *82 reusable connection: 1
2016/04/13 13:52:18 [debug] 27207#0: *82 event timer add: 9: 180000:1460548518022
2016/04/13 13:52:18 [debug] 27207#0: worker cycle
2016/04/13 13:52:18 [debug] 27207#0: epoll timer: 180000
@oschaaf
oschaaf / chrome-http2.log
Last active April 13, 2016 13:04
chrome http2 trace nginx 1.9.14 post to non-existant url
94784: HTTP2_SESSION
192.168.137.10:4430 (DIRECT)
Start Time: 2016-04-13 15:01:23.229
t=331196 [st= 0] +HTTP2_SESSION [dt=?]
--> host = "192.168.137.10:4430"
--> proxy = "DIRECT"
t=331196 [st= 0] HTTP2_SESSION_INITIALIZED
--> protocol = "h2"
--> source_dependency = 94783 (SOCKET)
@oschaaf
oschaaf / index.html
Created July 12, 2016 15:02
absolute path rewriting
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
@oschaaf
oschaaf / disable-cache-cleaning.diff
Created July 13, 2016 09:40
disable cache cleaning hack
diff --git a/pagespeed/kernel/cache/file_cache.cc b/pagespeed/kernel/cache/file_cache.cc
index 3951c02..f595832 100644
--- a/pagespeed/kernel/cache/file_cache.cc
+++ b/pagespeed/kernel/cache/file_cache.cc
@@ -304,6 +304,7 @@ void FileCache::CleanWithLocking(int64 next_clean_time_ms) {
}
bool FileCache::ShouldClean(int64* suggested_next_clean_time_ms) {
+ return false;
bool to_return = false;