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
def parse_cpu_info(): | |
cpu = {} | |
for line in open("/proc/cpuinfo"): | |
if ':' in line: | |
k, v = line.split(":", 1) | |
k = k.strip() | |
v = v.strip() | |
cpu[k] = v | |
if not line.strip(): |
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
module Notice; | |
export { | |
redef enum Action += { | |
ACTION_TM_QUERY, | |
}; | |
const tm_query_types: set[Type] = {} &redef; | |
} |
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
##! Add the peer to the connection logs. | |
module Conn; | |
export { | |
redef record Conn::Info += { | |
peer: string &optional &log; | |
}; | |
} |
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
# /etc/sysconfig/modules/pfring.modules | |
if [ ! -e /proc/net/pfring ] ; then | |
exec /sbin/modprobe pf_ring enable_tx_capture=0 min_num_slots=32768 >/dev/null 2>&1 | |
fi |
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 python | |
import os | |
import sys | |
import time | |
SIZE_TIMEOUT = 10 | |
def get_size(f): | |
for x in range(SIZE_TIMEOUT): | |
try: |
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
module TerminateConnection; | |
export { | |
redef enum Notice::Type += { | |
TerminatingConnection, # connection will be terminated | |
TerminatingConnectionIgnored, # connection terminated disabled | |
}; | |
# Whether we're allowed (and/or are capable) to terminate connections | |
# using "rst". |
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
redef exit_only_after_terminate = T; | |
event test() | |
{ | |
local src = 1.2.3.4; | |
local dst = 8.8.8.8; | |
local output = ""; | |
if ( T ) | |
{ | |
when ( local src_name = lookup_addr(src) ) |
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
from urllib2 import urlopen | |
from urllib import urlencode | |
import simplejson | |
class SolrSearcher: | |
def __init__(self, url): | |
self.url = url | |
def search(self, q, **kwargs): | |
args = {'q': q, 'wt': 'json'} |
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
class approx::server { | |
package {'approx': | |
ensure => latest; | |
} | |
config_file { "/etc/approx/approx.conf": | |
source => "puppet://$servername/approx/approx.conf", | |
require => Package['approx'], | |
} |
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 python | |
import difflib | |
import sys | |
import tarfile | |
def read(fn): | |
with open(fn) as f: | |
return f.readlines() |
OlderNewer