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 python3 | |
from collections import defaultdict | |
import string | |
import sys | |
def get_words(): | |
words = [w.strip() for w in open("wordle-nyt-allowed-guesses.txt")] | |
words += [w.strip() for w in open("wordle-nyt-answers-alphabetical.txt")] | |
words = set(words) |
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 | |
BRO_CERT_TEMPLATE = """#auto generated | |
redef SSL::root_certs += { | |
["%(subject)s"] = "%(cert)s" | |
}; | |
""" |
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
[Unit] | |
Description=Bro | |
After=network.target | |
[Service] | |
ExecStartPre=-/bro/bin/broctl cleanup | |
ExecStartPre=/bro/bin/broctl check | |
ExecStartPre=/bro/bin/broctl install | |
ExecStart=/bro/bin/broctl start | |
ExecStop=/bro/bin/broctl stop |
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
event log_one (n:count) | |
{ | |
Reporter::info(fmt("Hello %d", n)); | |
if(n != 0) { | |
schedule 1sec { log_one(n-1) }; | |
} | |
} | |
event bro_init() | |
{ |
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 sys | |
phrase = sys.argv[1] | |
parts = [l + l.upper() for l in phrase.lower()] | |
regex = ''.join(['[%s]' % part for part in parts]) | |
print regex |
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 | |
DEFAULT_LOG = "/usr/local/bro/logs/current/conn.log" | |
def config(): | |
print """ | |
graph_category network |
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 DNS; | |
event log_one (n:count) | |
{ | |
local info: Info; | |
local id: conn_id; | |
id$orig_h = 1.2.3.4; | |
id$orig_p = 23121/udp; | |
id$resp_h = 5.6.7.8; |
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 class defines a grub2-mkconfig exec block so that other | |
# classes can refresh it. | |
class hardware::grub { | |
exec { 'grub2-mkconfig': | |
command => '/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg', | |
refreshonly => true, | |
user => 'root', | |
} | |
} |
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
#!/bin/sh -x | |
# cd /path/to/application/root | |
# convert_rrd.sh otherhost /new/application/root | |
HOST=$1 | |
DIR=$2 | |
for f in `find -name '*.rrd'`; do | |
rrdtool dump $f | ssh $HOST "cat > ~/dump.xml" | |
ssh $HOST "cd $DIR;rrdtool restore -f ~/dump.xml $f" |
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
use std::collections::HashMap; | |
use std::io::{self, BufRead, BufWriter}; | |
use std::io::Write; | |
fn count(max_rows: usize) -> Result<(), io::Error> { | |
let stdin = io::stdin(); | |
let mut counts = HashMap::new(); | |
for line in stdin.lock().lines() { | |
let l = line.unwrap(); | |
let stat = counts.entry(l).or_insert(0); |
NewerOlder