Skip to content

Instantly share code, notes, and snippets.

View smly's full-sized avatar
👁️‍🗨️

smly smly

👁️‍🗨️
View GitHub Profile
$ while (true); do curl -s -o /dev/null -w "%{http_code}\n" localhost:8080/bid; done
200
200
200
200
204
200
200
200
^C
events {
}
http {
limit_req_zone $binary_remote_addr zone=nobid:1m rate=100r/s;
server {
listen 8080;
@smly
smly / meryl.rb
Created September 3, 2013 16:09
wrapping flightquest simulator
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require 'webrick'
require 'logger'
# Requirements:
# * ruby >= 2
# * mono
# * FlightQuest Simulator
@smly
smly / Nginx_limit_req_status_handle_204_res.patch
Last active December 21, 2015 15:29
In OpenRTB, "No-Bids" on all impressions are indicated as HTTP 204 response. It would be useful to handle 204 in limit_req_status/limit_conn_status directives. (ref: http://www.iab.net/media/file/OpenRTB-API-Specification-Version-2-1-FINAL.pdf)
diff --git a/src/http/modules/ngx_http_limit_conn_module.c b/src/http/modules/ngx_http_limit_conn_module.c
index 7f0eea7..0d29f6b 100644
--- a/src/http/modules/ngx_http_limit_conn_module.c
+++ b/src/http/modules/ngx_http_limit_conn_module.c
@@ -76,7 +76,7 @@ static ngx_conf_enum_t ngx_http_limit_conn_log_levels[] = {
static ngx_conf_num_bounds_t ngx_http_limit_conn_status_bounds = {
- ngx_conf_check_num_bounds, 400, 599
+ ngx_conf_check_num_bounds, 201, 599
@smly
smly / xsystem35-1.7.2.patch
Created June 15, 2013 09:50
xsystem35-1.7.2 を build するため+WM_CLASS を設定するパッチ
diff --git src/cmd2F.c src/cmd2F.c
index cd160b8..3c7b505 100644
--- src/cmd2F.c
+++ src/cmd2F.c
@@ -1381,7 +1381,7 @@ void commands2F81() {
for (i = 0; i < eNumof; i++) {
*vData = LittleEndian_getW(nact->datatbl_addr, 0);
- ((WORD *)nact->datatbl_addr)++;
+ nact->datatbl_addr++;
[flake8]
# Ignore N804,N805
# N804: first argument of a classmethod should be named 'cls'
# N805: first argument of a method should be named 'self'
ignore = N804,N805
@smly
smly / test_rod.py
Last active December 15, 2015 21:19
Run rod for test
#!/usr/bin/env python
# coding: utf-8
"""
Run rod for test.
"""
import sys
import os
sys.path.append(
@smly
smly / slide.md
Created March 12, 2013 18:36
Markdown + Pandoc + Shower = XD

% Markdown + Pandoc + Shower = XD % @smly % 2013-03-13

Markdown + Pandoc + Shower = XD

Shower のスライドを Markdown で作る話

  • まとめ
@smly
smly / smly.shower
Created March 12, 2013 18:34
template for shower
<!DOCTYPE html>
<html$if(lang)$ lang="$lang$"$endif$>
<head>
<title>$if(title-prefix)$$title-prefix$ - $endif$$pagetitle$</title>
<meta charset="utf-8">
<meta name="viewport" content="width=680, user-scalable=no">
<meta name="generator" content="pandoc" />
$for(author-meta)$
<meta name="author" content="$author-meta$" />
$endfor$
@smly
smly / load_df.py
Created February 24, 2013 06:17
DataFrame.ix & DataFrame.merge
# %run ipython/load_df.py
import pandas as pd
df = pd.load('pickle/train_test_tsv2_data_frame.pd.pickle')
fea = pd.load('pickle/actions_feature.pd.pickle')
train = pd.DataFrame(df.ix['train']['UserID'].drop_duplicates())
train = train.merge(fea)
test = pd.DataFrame(df.ix['test']['UserID'].drop_duplicates())
test = test.merge(fea)