Skip to content

Instantly share code, notes, and snippets.

View JustinAzoff's full-sized avatar

Justin JustinAzoff

View GitHub Profile
@JustinAzoff
JustinAzoff / solve.py
Last active August 6, 2022 21:04
Summer of Math Exposition 2
#!/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)
@JustinAzoff
JustinAzoff / beat.bro
Created October 11, 2018 21:52
bro zeromq examples
event log_one (n:count)
{
Reporter::info(fmt("Hello %d", n));
if(n != 0) {
schedule 1sec { log_one(n-1) };
}
}
event bro_init()
{
@JustinAzoff
JustinAzoff / logflood.bro
Created March 1, 2018 15:31
flood bro dns log for testing.
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;
@JustinAzoff
JustinAzoff / isolation.pp
Created September 28, 2017 21:17
puppet stuff to enable linux cpu isolation
# 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',
}
}
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);
@JustinAzoff
JustinAzoff / bro.service
Last active March 22, 2021 11:43
Broctl systemd unit
[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
#!/bin/bash -e
REPO=git://git.bro.org/bro
STATE_FILE=/usr/local/bro/INSTALLED_VERSION
function die {
echo $*
exit 1
}

Start:

./manager.py
./data.py 1
./data.py 2
./worker.py 2
./worker.py 2
./worker.py 2
./worker.py 2
event bro_init()
{
Log::remove_default_filter(Files::LOG);
Log::add_filter(Files::LOG, [
$name = "files-split",
$path_func(id: Log::ID, path: string, rec: Files::Info) = {
if (rec?$mime_type && rec$mime_type == "application/pkix-cert")
return "files_certs";
return "files";
}
@JustinAzoff
JustinAzoff / long.py
Created November 14, 2016 16:10
output length of longest lines
#!/usr/bin/env python2
import sys
m=2000
for line in sys.stdin:
if len(line) > m:
print len(line)
m = len(line)