Skip to content

Instantly share code, notes, and snippets.

View atz's full-sized avatar
:octocat:

Joe Atzberger atz

:octocat:
  • Corelight
  • Columbus, OH
View GitHub Profile
@atz
atz / net.py
Created November 19, 2021 00:04
suricata-update net.py section usefully allows setting arbitrary HTTP headers. This is a minimal extraction and adaptation of lines allowing execution.
import re
def is_header_clean(header):
if len(header) != 2:
return False
name, val = header[0].strip(), header[1].strip()
if re.match( r"^[\w-]+$", name) and re.match(r"^[\w\s -~]+$", val):
return True
return False
@atz
atz / list.tf
Last active December 6, 2018 23:58
Terraform list-in/list-out operational
module "example1" {
source = "./list"
}
module "example2" {
source = "./list"
values = ["this", "that", "other"]
}
module "example3" {
source = "./list"
values = ["${module.example2.many}"]
@atz
atz / solr.json
Created October 12, 2018 00:08
Workflow Definitions for Dor::WorkflowObject
[
{ "id":"druid:vn914kc9255",
"workflowDefinition": {"dsLabel":"Workflow Definition","dsVersionID":"workflowDefinition.6","dsCreateDate":"2018-05-18T16:59:02Z","dsState":"A","dsMIME":"text/xml","dsFormatURI":null,"dsControlGroup":"X","dsSize":1647,"dsVersionable":true,"dsInfoType":null,"dsLocation":"druid:vn914kc9255+workflowDefinition+workflowDefinition.6","dsLocationType":null,"dsChecksumType":"DISABLED","dsChecksum":"none"}},"objLabel":"etdSubmitWF","objOwnerId":"fedoraAdmin","objModels":["info:fedora/fedora-system:FedoraObject-3.0","info:fedora/afmodel:Dor_WorkflowObject"],"objCreateDate":"2012-04-30T17:40:28Z","objLastModDate":"2018-05-18T16:59:02Z","objDissIndexViewURL":"https://localhost:443/fedora/objects/druid%3Avn914kc9255/methods/fedora-system%3A3/viewMethodIndex","objItemIndexViewURL":"https://localhost:443/fedora/objects/druid%3Avn914kc9255/methods/fedora-system%3A3/viewItemIndex","objState":"A"}"]},
{ "id":"druid:fj761tg0163",
"workflowDefinition": {"dsLabel":"Workflow Definition","dsVersion
@atz
atz / traceroute.txt
Last active September 13, 2018 18:55
can't route to rubygems?
$ traceroute rubygems.org
traceroute: Warning: rubygems.org has multiple addresses; using 151.101.192.70
traceroute to rubygems.org (151.101.192.70), 64 hops max, 52 byte packets
1 10.0.0.1 (10.0.0.1) 69.025 ms 55.048 ms 24.030 ms
2 96.120.91.9 (96.120.91.9) 42.344 ms 16.853 ms 19.971 ms
3 be-10028-rur01.santaclara.ca.sfba.comcast.net (68.85.216.97) 82.559 ms 16.514 ms 57.404 ms
4 162.151.78.253 (162.151.78.253) 22.618 ms 33.143 ms 13.133 ms
5 be-3651-cr02.sunnyvale.ca.ibone.comcast.net (68.86.91.73) 19.991 ms 16.767 ms 17.342 ms
6 be-11025-cr01.9greatoaks.ca.ibone.comcast.net (68.86.87.158) 40.005 ms 54.673 ms 32.714 ms
7 hu-0-13-0-0-pe03.11greatoaks.ca.ibone.comcast.net (68.86.83.134) 39.771 ms 30.620 ms 38.479 ms
@atz
atz / scratch.md
Last active July 28, 2018 06:56
File renaming for Nicole
find . -type f -name [0-9]* .      # only files starting w/ digits
find . -type f -name [0-9]*.mp3    # only files starting w/ digits, ending in ".mp3"
find . -type f -name "[0-9]x[0-9] - *.mp3"        # ex. "1x01 - Original Pilot.mp3"
find . -type f -name "[0-9][0-9] *.mp3"           # ex. "01 Brave.mp3"
find . -type f -name "[0-9][0-9]-[0-9][0-9]*.mp3" # ex. "01-05Everywhere.mp3"
...
find . -type f -name "[0-9]x[0-9] - *.mp3" -o -name "[0-9][0-9] *.mp3" -0 -name "[0-9][0-9]-[0-9][0-9]*.mp3" # catch'm all

find . -type f -name "[0-9]x[0-9] - *.mp3" -exec rename 's/\/\d+x\d+ - ([^\/]*)$/\/$1/' {} \; # /x/y/Original Pilot.mp3
Endpoint.which_need_archive_copy("bj102hs9687",2)
SELECT "endpoints".* FROM "endpoints"
INNER JOIN "endpoint_types" ON "endpoint_types"."id" = "endpoints"."endpoint_type_id"
INNER JOIN "endpoints_preservation_policies" ON "endpoints_preservation_policies"."endpoint_id" = "endpoints"."id"
INNER JOIN "preservation_policies" ON "preservation_policies"."id" = "endpoints_preservation_policies"."preservation_policy_id"
INNER JOIN "preserved_objects" ON "preserved_objects"."preservation_policy_id" = "preservation_policies"."id"
WHERE "endpoint_types"."endpoint_class" = $1
AND "preserved_objects"."druid" = $2
AND (NOT (EXISTS (
@atz
atz / Gemfile.lock.diff
Created April 26, 2018 01:03
common-accessioning Gemfile.lock diff between b8d496207c7e5f207ef5939028bd6f6152be9d9e and 23f5b9543633cdb638f1e55aa42f8e2375111f81
diff --git a/Gemfile.lock b/Gemfile.lock
index 1ea400c..16a045c 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,7 +1,7 @@
GEM
remote: https://rubygems.org/
specs:
- active-fedora (8.4.0)
+ active-fedora (8.4.2)
@atz
atz / update_dependencies.sh
Last active March 31, 2018 01:14
Plow through enumerated ruby apps, update gems and create PRs
#!/bin/bash
#
# requires Github CLI extensions (`hub`)
# Hub w/ multifactor authentication requires 4 lines in ~/.config/hub like:
# ---
# github.com:
# - oauth_token: SOME_TOKEN_STRING
# user: atz
#
# Get the token string from a new token here: https://github.com/settings/tokens
@atz
atz / output.xml
Last active October 12, 2017 00:55
wos_publication dumps for missing IDs
$ for x in 000206244200003 000174038800007 000188997700136 000288081900013 000183571800002 000297154900052 000224524400014; do echo $x; RAILS_ENV=production bundle exec rake sw:wos_publication[$x] ; done
000206244200003
Unable to load RSpec.
<?xml version="1.0"?>
<ArrayOfPublicationItem xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<PublicationItem>
<PublicationItemID>31250899</PublicationItemID>
<Title>The FEATURE framework for protein function annotation: modelling new functions, improving performance, and extending to novel applications</Title>
<Abstract>Structural genomics efforts contribute new protein structures that often lack significant sequence and fold similarity to known proteins. Traditional sequence and structure-based methods may not be sufficient to annotate the molecular functions of these structures. Techniques that combine structural and functional modeling can be valuable for functional annotation. FEATURE is a flexible fr
@atz
atz / curl.txt
Last active September 29, 2017 19:01
WoS request failing (400 error)
curl -v -H "Content-Type: text/xml;charset=UTF-8" -H 'Cookie: SID="3AXgqFUsHT3lTpcgEhQ"' -d @wtf.xml "http://search.webofknowledge.com/esti/wokmws/ws/WokSearch"
* Trying 167.68.24.86...
* TCP_NODELAY set
* Connected to search.webofknowledge.com (167.68.24.86) port 80 (#0)
> POST /esti/wokmws/ws/WokSearch HTTP/1.1
> Host: search.webofknowledge.com
> User-Agent: curl/7.52.1
> Accept: */*
> Content-Type: text/xml;charset=UTF-8
> Cookie: SID="3AXgqFUsHT3lTpcgEhD"