Skip to content

Instantly share code, notes, and snippets.

View erikcw's full-sized avatar

Erik Wickstrom erikcw

View GitHub Profile

Keybase proof

I hereby claim:

  • I am erikcw on github.
  • I am erikwickstrom (https://keybase.io/erikwickstrom) on keybase.
  • I have a public key whose fingerprint is 0D63 3A09 58DF 38F2 1491 52E5 7856 2211 74A1 3F19

To claim this, I am signing this object:

@erikcw
erikcw / How stable are Google gids.ipynb
Created July 19, 2019 19:39
notebooks/How stable are Google gids.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@erikcw
erikcw / in-container.log
Created February 25, 2016 17:34
Attaching GDB to nginx running inside docker container.
root@b13239f0d920:/opt/openresty/nginx/conf# ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 21564 2228 ? Ss Feb24 0:00 /usr/bin/lua -lluarocks.loader /usr/local/lib/luarocks/rocks/lapis/1.4.3-1/bin/lapis server production
root 20 0.0 0.0 4440 652 ? S Feb24 0:00 sh -c /opt/openresty/nginx/sbin/nginx -p "$(pwd)"/'' -c 'nginx.conf.compiled'
root 22 0.0 0.1 54944 4280 ? S Feb24 0:00 nginx: master process /opt/openresty/nginx/sbin/nginx -p /opt/openresty/nginx/conf/ -c nginx.conf.compiled
nobody 24 0.0 0.0 54944 1964 ? S Feb24 0:00 nginx: cache manager process
nobody 473 94.6 25.9 1107220 1050740 ? R 02:22 861:17 nginx: worker process is shutting down
root 478 0.1 0.0 18156 1964 ? Ss 17:30 0:00 bash
root 498 0.0 0.0 15564 1144 ? R+ 17:31 0:00 ps aux
root@b13239f0d920:/opt/openresty/nginx/conf# gdb /opt/openresty/nginx/sbin/n
@erikcw
erikcw / nginx.conf
Last active August 22, 2023 10:58
Simple nginx lua script to add UUID to each request for end to end request tracking.
# Dependencies
# nginx_lua
# lua uuid module (luarocks install uuid)
http {
# this will be the request id
map $host $request_uuid {
default '';
}
@erikcw
erikcw / models0.py
Last active August 29, 2015 14:05
ForeignKey to IntegerField South Migration
# Initial state
class LogData(models.Model):
report_job = models.ForeignKey('myapp.ReportJobs')
#... more fields ...
@erikcw
erikcw / fiddle.response.json
Last active August 29, 2015 14:05
This is test data for jsFiddle
{
"meta": {
"limit": 10,
"next": "/api/v1/audience/?draw=1&order_by=description&shared_audiences=true&limit=10&offset=10&stats=false",
"offset": 0,
"previous": null,
"total_count": 18
},
"objects": [{
"advertisers": [],
from django.db import models
class SampleModel(models.Model):
"""
blah blah
"""
sample = models.IntegerField(blank=True, null=True, help_text="just need more quotes")
sample = models.IntegerField(blank=True, null=True, help_text="just need more quotes")
sample = models.IntegerField(blank=True, null=True, help_text="just need more quotes")
sample = models.IntegerField(blank=True, null=True, help_text="just need more quotes")
@erikcw
erikcw / README
Last active December 25, 2015 22:19
# Directions for reproducing the issue
/usr/local/openresty/nginx/sbin/nginx -p `pwd`/ -c nginx.conf.debug
Load the '/' URI. Then refresh twice -- the backtrace will dump to the console on the 3rd refresh.
local headers = ngx.req.get_headers()
headers['CF_VISITOR'] = ngx.var.x_scheme_json
headers['X-Forwarded-Host'] = ngx.var.host
url = "http://localhost:8888" .. tostring(ngx.var.uri)
local res = ngx.location.capture('/proxy', {
ctx = {
headers = headers
},
vars = {
_url = url
*** glibc detected *** nginx: worker process: double free or corruption (!prev): 0x0000000001b30300 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x7eb96)[0x7f2905687b96]
nginx: worker process(ngx_destroy_pool+0x54)[0x4181cc]
nginx: worker process(ngx_http_free_request+0x157)[0x44413b]
nginx: worker process[0x4448e5]
nginx: worker process(ngx_http_finalize_request+0x41a)[0x445256]
nginx: worker process(ngx_http_lua_finalize_request+0x13)[0x49ee3b]
nginx: worker process[0x4a4649]
nginx: worker process(ngx_http_lua_content_wev_handler+0x1b)[0x49fc8b]