Skip to content

Instantly share code, notes, and snippets.

@jordansissel
jordansissel / x.md
Last active December 18, 2015 22:30
Bluetooth on Linux is a cruel joke.

Feb 20 04:33:47 raspberrypi pulseaudio[2524]: [pulseaudio] bluetooth-util.c: org.bluez.Manager.ListAdapters() failed: org.freedesktop.DBus.Error.AccessDenied: Rejected send message, 2 matched rules; type="method_call", sender=":1.6" (uid=1000 pid=2524 comm="/usr/bin/pulseaudio --start --log-target=syslog ") interface="org.bluez.Manager" member="ListAdapters" error name="(unset)" requested_reply="0" destination="org.bluez" (uid=0 pid=2255 comm="/usr/sbin/bluetoothd ")

Feb 20 04:33:47 raspberrypi pulseaudio[2524]: [pulseaudio] server-lookup.c: Unable to contact D-Bus: org.freedesktop.DBus.Error.NotSupported: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11

Feb 20 04:33:47 raspberrypi pulseaudio[2524]: [pulseaudio] main.c: Unable to contact D-Bus: org.freedesktop.DBus.Error.NotSupported: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11

% rspec examples/socket_analyze_spec.rb
F
Failures:
[4/1946]
1) TCPServer on a random port should bind successfully
Failure/Error: raise Analysis.new(results)
32.31% tests successful of 2315 tests
Failure analysis:
48.64% -> [1126] SocketError

Computing it -

% curl -s 'localhost:9200/logstash-*/_search?pretty' -d @req.json | jq '[ .aggregations["2"].buckets[] | { key: (.key_as_string), value: (.["3"].buckets[]["4"].buckets | .[1]["doc_count"] / .[0]["doc_count"]) } ] | [ .[].value ] | length as $count | add / $count'

0.005472730173337497

@jordansissel
jordansissel / tshark-logstash.conf
Created February 7, 2015 05:56
Parsing tshark -V output with logstash
input { stdin { } }
output {
stdout {
#codec => rubydebug
codec => dots
}
elasticsearch {
protocol => http
% echo '{ "array": [ { "one": 1 }, { "two": 2 }, { "three": 3 } ] }' | bin/logstash -f test.conf
{
"one" => 1,
"@version" => "1",
"@timestamp" => "2015-01-29T01:09:02.813Z"
}
{
"two" => 2,
"@version" => "1",
"@timestamp" => "2015-01-29T01:09:02.814Z"
% bin/logstash -e 'filter { mutate { gsub => [ "message", "-", "none" ] } }'
hello - world
- - -
---
{
"message" => "hello none world",
"@version" => "1",
"@timestamp" => "2015-01-22T19:22:38.208Z",
"type" => "stdin",
input {
generator {
count => 1
lines => [
"qid=ABCD1 first",
"qid=XYZ2 first",
"qid=ABCD1 second",
"qid=XYZ2 second",
"qid=ZZZZ first",
"qid=ABCD1 third"
```
2015-01-13 18:13:30
Full thread dump Java HotSpot(TM) 64-Bit Server VM (24.71-b01 mixed mode):
">output" daemon prio=10 tid=0x000000000153e800 nid=0x6b3 in Object.wait() [0x00007f92e73da000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x00000000e7991b88> (a org.jruby.ext.thread.SizedQueue)
at java.lang.Object.wait(Object.java:461)
at org.jruby.RubyThread$SleepTask.run(RubyThread.java:1049)
@jordansissel
jordansissel / data.md
Last active August 29, 2015 14:09
SSL/TLS. JRuby, BouncyCastle, OpenSSL, MRI. Fun.

Try openssl ciphers in ruby 2.1.4 on google.com

% openssl ciphers | tr : '\n'| rvm 2.1.4 do ruby -an -rsocket -ropenssl -e 'cipher = $_.chomp; begin; x = TCPSocket.new("google.com", 443); c = OpenSSL::SSL::SSLContext.new; c.ciphers = cipher; o = OpenSSL::SSL::SSLSocket.new(x, c); o.connect; o.close; puts "OK #{cipher}"; rescue => e; puts "FAIL #{cipher} - #{e}"; end' | sort
FAIL DES-CBC-MD5 - SSL_CTX_set_cipher_list: no cipher match
FAIL DES-CBC-SHA - SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: sslv3 alert handshake failure
FAIL DES-CBC3-MD5 - SSL_CTX_set_cipher_list: no cipher match
FAIL DHE-DSS-AES128-SHA - SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: sslv3 alert handshake failure
FAIL DHE-DSS-AES256-SHA - SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: sslv3 alert handshake failure
curl http://tachyon.vektra.io/install.sh > it.sh && test $(openssl sha1 < it.sh) = "23fb0450b152dfaa8331dd37c3a4c13d4de9dbb8" && bash it.sh