Skip to content

Instantly share code, notes, and snippets.

View mehaase's full-sized avatar

Mark E. Haase mehaase

View GitHub Profile

Keybase proof

I hereby claim:

  • I am mehaase on github.
  • I am mehaase (https://keybase.io/mehaase) on keybase.
  • I have a public key whose fingerprint is BF91 D496 A3D4 01A7 34C2 64E4 8E7E F260 1A7F E635

To claim this, I am signing this object:

@mehaase
mehaase / extract_vocab.py
Created August 3, 2016 05:25
extract dictionary words from a strnig
with open('/usr/share/dict/american-english') as vocab_file:
_vocab = {line.strip() for line in vocab_file}
def _extract_words(string, min_=3):
''' Return set of maximal length, non-overlapping dictionary words in `string`. '''
words = set()
candidate_len = len(string)
while candidate_len >= min_:
for start in range(0, len(string) - candidate_len + 1):
candidate = string[start:start+candidate_len]
server {
# ...other server stuff here, e.g. TLS...
location / {
rewrite ^/(packages/.*|index.html|main\..*) /$1 break;
rewrite ^/.* /index.html;
proxy_pass http://localhost:8080;
proxy_http_version 1.1;
}
}
@mehaase
mehaase / winecho.py
Last active September 2, 2017 16:04
For writing a file to windows over a command shell.
import sys
if len(sys.argv) < 3:
print('Usage: {} <DEST FILE> <INPUT FILE>'.format(sys.argv[0]))
sys.exit(1)
dest_path = sys.argv[1]
in_path = sys.argv[2]
def escape(line):
@mehaase
mehaase / iosmap.tcl
Created September 2, 2017 17:38
IOSmap rewritten so that it can be used in memory, not written to permanent storage.
set timeout 1
set timeoutms 500
set waittime 4000
set svcarraymax 4096
set reasoncode 0
set reason "NULL"
proc syntaxhelp {} {
puts stdout "\7================================================================"
puts stdout "IOScan 0.1"
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mehaase
mehaase / checkpoint.py
Created December 9, 2021 17:51
Checkpoint iterators
class CheckpointIter:
def __init__(self):
self.checkpoints = list()
def every(self, n_items, do_this):
self.checkpoints.append((n_items, do_this))
def iter(self, iterable):
i = 1
for item in iterable:

Mermaid Test

Making a Markdown file that has embedded mermaid graph.

flowchart
  classDef action color:black,fill:pink
  classDef asset color:black,fill:lightblue
  classDef property color:black,fill:lightgreen
@mehaase
mehaase / gist:f527922dd56e75ea08e82b01c4ab1253
Created September 2, 2022 17:00
Alternat ATT&CK Powered Suit search form
<div class="gray-box">
<p class="text-muted small">
Select the types of objects to include in search results:
</p>
<div class="row">
<div class="col">
<div class="form-check form-switch">
<input
id="tactics"
type="checkbox"