Skip to content

Instantly share code, notes, and snippets.

View vmanyushin's full-sized avatar

Viktor Manyushin vmanyushin

View GitHub Profile
#
# Slightly tighter CORS config for nginx
#
# A modification of https://gist.github.com/1064640/ to include a white-list of URLs
#
# Despite the W3C guidance suggesting that a list of origins can be passed as part of
# Access-Control-Allow-Origin headers, several browsers (well, at least Firefox)
# don't seem to play nicely with this.
#
#!/usr/bin/python
def hrun(start, width, padding=0):
return [None] * padding + range(start, start+width) + [None] * padding
def vrun(start, width, height, padding=0):
return [hrun(s, width, padding)
for s in range(start, start+width*height, width)]
layout = [
port = 10051
s = Zabbix::Sender.new 'zabbix-server', port
pp s.send('host', 'key', 'value')
# => {"response"=>"success",
# "info"=>"Processed 1 Failed 0 Total 1 Seconds spent 0.000042"}
pp s.to('host') {
send 'key', 'value'