Skip to content

Instantly share code, notes, and snippets.

View ottomata's full-sized avatar

Andrew Otto ottomata

View GitHub Profile
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="test"/>
<classpathentry kind="src" path="resources"/>
<classpathentry kind="lib" path="lib/commons-logging-1.1.jar"/>
<classpathentry kind="lib" path="lib/junit-4.1.jar" sourcepath="/home/rainman/lucene/junit-4.1-src.jar"/>
<!-- <classpathentry kind="lib" path="lib/log4j-1.2.14.jar"/> -->
<classpathentry kind="lib" path="lib/lucene-analyzers.jar"/>
<classpathentry kind="lib" path="lib/ws-commons-util-1.0.1.jar"/>
# UDPLogger query log string
mw_wmvm 2012-07-06T18:49:22Z MediaWiki oh yeah
# scribe log4j query log string
[wmvm.localdomain] 2012-07-06T21:21:15.489 mw_wmvm Main%20Page 1 572.818603515625 - 0 - Main_Page
[wmvm.localdomain] 2012-07-06T21:21:20.345 mw_wmvm Main 1 0.2586228847503662 - 0 - Main_Page
[wmvm.localdomain] 2012-07-06T21:21:25.701 mw_wmvm Page 1 0.2586228847503662 - 0 - Main_Page
[wmvm.localdomain] 2012-07-06T21:21:30.025 mw_wmvm Mediawiki 1 0.164380490779876 - 0 - Main_Page
[wmvm.localdomain] 2012-07-06T21:21:34.210 mw_wmvm asdf 0 - - - - -
diff --git a/src/org/wikimedia/lsearch/frontend/SearchDaemon.java b/src/org/wikimedia/lsearch/frontend/SearchDaemon.java
index bf6771d..ef8d6bc 100644
--- a/src/org/wikimedia/lsearch/frontend/SearchDaemon.java
+++ b/src/org/wikimedia/lsearch/frontend/SearchDaemon.java
@@ -91,7 +91,7 @@ public class SearchDaemon extends HttpHandler {
dbname = paths[2];
searchterm = paths[3].trim();
- log.info(MessageFormat.format("query:{0} what:{1} dbname:{2} term:{3}",
+ log.debug(MessageFormat.format("query:{0} what:{1} dbname:{2} term:{3}",
@ottomata
ottomata / GeoIP.h
Created July 11, 2012 19:09
geoip code
//...
typedef enum {
GEOIP_CHARSET_ISO_8859_1 = 0,
GEOIP_CHARSET_UTF8 = 1
} GeoIPCharset;
//...
@ottomata
ottomata / gist:3099134
Created July 12, 2012 16:21
cidr_includes
$ ./cidr_includes 192.168.0.1/24 192.168.0.10
Does 192.168.0.1/24 contain 192.168.0.10/32? yes
$ ./cidr_includes 192.168.0.1/24 192.168.5.10
Does 192.168.0.1/24 contain 192.168.5.10/32? no
$ ./cidr_includes 2620:0:860:2::/64 2620:0:860:2:0:0:0:0005
Does 2620:0:860:2::/64 contain 2620:0:860:2::5/128? yes
$ ./cidr_includes 2620:0:860:2::/64 2620:0:860:3:0:0:0:0005
@ottomata
ottomata / gist:3101200
Created July 12, 2012 21:37
cidr filtering
cat /a/log/short.log | ./udp-filter -i 71.190.22.0/24,197.30.159.0/22,fe80::e6ce:8fff:fe37:/16,2607:f0d0:1002:51::/64
wmvm.localdomain 47 2012-04-28T22:42:50.827 0 71.190.22.42 TCP_MISS/200 464 GET http://wmvm.wikimedia.org/ FIRST_UP_PARENT/wmvm text/html - - curl/7.21.4%20(universal-apple-darwin11.0)%20libcurl/7.21.4%20OpenSSL/0.9.8r%20zlib/1.2.5 en-US
wmvm.localdomain 48 2012-04-28T22:42:50.835 0 197.30.159.35 TCP_MISS/200 464 GET http://wmvm.wikimedia.org/ FIRST_UP_PARENT/wmvm text/html - - curl/7.21.4%20(universal-apple-darwin11.0)%20libcurl/7.21.4%20OpenSSL/0.9.8r%20zlib/1.2.5 en-US
wmvm.localdomain 49 2012-04-28T22:42:50.843 0 fe80::e6ce:8fff:fe37 TCP_MISS/200 464 GET http://wmvm.wikimedia.org/ FIRST_UP_PARENT/wmvm text/html - - curl/7.21.4%20(universal-apple-darwin11.0)%20libcurl/7.21.4%20OpenSSL/0.9.8r%20zlib/1.2.5 en-US
wmvm.localdomain 50 2012-04-28T22:42:50.851 0 2607:f0d0:1002:51::4 TCP_MISS/200 464 GET http://wmvm.wikimedia.org/ FIRST_UP_PARENT/wmvm text/html - - curl/7.21.4%20(universal-apple-d
# deny all incoming traffic, but allow outgoing
iptables -P OUTPUT ACCEPT
iptables -P INPUT DROP
# allow ping
iptables -A INPUT -p icmp --icmp-type echo-request -j ACCEPT
# allow loopback
iptables -A INPUT -i lo -j ACCEPT
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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
@ottomata
ottomata / Commands.sh
Created August 7, 2012 16:05
kafka failed broker tests
# Asynchronous (batched) producer:
./sequence_generate.sh 20000 10000 | bin/kafka-console-producer.sh --zookeeper analytics1003:2181 --topic test6
# Synchronous producer:
./sequence_generate.sh 20000 10000 | bin/kafka-producer-shell.sh --props config/producer.properties --topic test6
# Consumer
bin/kafka-consumer-shell.sh --props config/consumer.properties --topic test6 | tee -a /tmp/test6.log
# sequence check
~ # ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN qlen 1000
link/ether 90:e2:ba:11:82:30 brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc mq state DOWN qlen 1000
link/ether 90:e2:ba:11:82:31 brd ff:ff:ff:ff:ff:ff