Skip to content

Instantly share code, notes, and snippets.

@JustinAzoff
JustinAzoff / solve.py
Last active Aug 6, 2022
Summer of Math Exposition 2
View solve.py
#!/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 Oct 11, 2018
bro zeromq examples
View beat.bro
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 Mar 1, 2018
flood bro dns log for testing.
View logflood.bro
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 Sep 28, 2017
puppet stuff to enable linux cpu isolation
View isolation.pp
# 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',
}
}
View count.rs
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 Mar 22, 2021
Broctl systemd unit
View bro.service
[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
View install_bro.sh
#!/bin/bash -e
REPO=git://git.bro.org/bro
STATE_FILE=/usr/local/bro/INSTALLED_VERSION
function die {
echo $*
exit 1
}
View README.md

Start:

./manager.py
./data.py 1
./data.py 2
./worker.py 2
./worker.py 2
./worker.py 2
./worker.py 2
View files-split-certs.bro
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 Nov 14, 2016
output length of longest lines
View long.py
#!/usr/bin/env python2
import sys
m=2000
for line in sys.stdin:
if len(line) > m:
print len(line)
m = len(line)