The listen poller is a poller that allows external sources to record metrics through a single shh instance. This means that any process that can produce output, can record metrics through shh. While this is happening, shh can concurrently collect and publish it's own metrics (from other pollers).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EPIGRAMS IN PROGRAMMING | |
1. One man's constant is another man's variable. | |
2. Functions delay binding; data structures induce binding. Moral: Structure data late in the programming process. | |
3. Syntactic sugar causes cancer of the semicolon. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(let* ((values '(11152 6423 8383 7466 6759 7249 6951 8793 7949 6840 7209 8022 11493 11331 6787 5616 9175 9528 7883 7210 10142)) | |
(sum (reduce '+ values)) | |
(avg (/ sum (length values))) | |
(mini (apply 'min values)) | |
(maxi (apply 'max values)) | |
(dev (reduce '+ (mapcar '(lambda (x) (* (- x avg) (- x avg))) values))) | |
(std (sqrt (/ dev (length values))))) | |
(list sum avg mini maxi dev std)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2.7 | |
"""html2text: Turn HTML into equivalent Markdown-structured text.""" | |
__version__ = "2.38" | |
__author__ = "Aaron Swartz (me@aaronsw.com)" | |
__copyright__ = "(C) 2004-2008 Aaron Swartz. GNU GPL 3." | |
__contributors__ = ["Martin 'Joey' Schulze", "Ricardo Reyes", "Kevin Jay North"] | |
# TODO: | |
# Support decoded entities with unifiable. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This inflates things pretty horribly since it's looking at | |
# raw lines (including comments, documentation, etc) rather | |
# than lines of code metrics that you might get from a tool | |
# like sloccount, or cloc | |
AUTHOR=apg | |
for n in {1..100}; do | |
PAGER=cat git log --numstat --since="$n days ago" --until="$(expr $n - 1) days ago" --author=$AUTHOR | grep '^[0-9]' | awk 'BEGIN { lines = 0 } { lines += ($1 - $2) } END { print lines }' | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var PENDING_INVITE = '#fff2cc'; | |
var INVITED = '#00ff00'; | |
var CONFIRMED = '#ffff00'; | |
var NOT_THIS_TIME = '#00ffff'; | |
var NOT_THIS_TIME_SENT = '#4a86e8'; | |
function markPerson(person, newtyp) { | |
var nameCell = person['range'].getCell(1, 1); | |
nameCell.setBackground(newtyp); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re, itertools | |
from PIL import Image | |
def str2pt(s): | |
L = len(s) - 1 | |
x, y = 1, 1 | |
for n in s: | |
y += 2**L if n in '34' else 0 | |
x += 2**L if n in '14' else 0 | |
L -= 1 |
- Why? Well, we couldn’t scale up anymore. (talking about MySQL)
- Shift in trust. (> more reliable)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
import itertools | |
(lambda port, s=socket.socket(socket.AF_INET, socket.SOCK_STREAM): | |
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) == None and | |
s.bind(('', port)) == None and | |
s.listen(5) == None and | |
list(map(lambda c: | |
c[0].sendall(c[0].recv(1024)) and | |
c[0].close(), | |
(s.accept() for _ in itertools.count(1)))) != None and |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bufio" | |
"io" | |
"regexp" | |
"strings" | |
"sync" | |
) |