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
# defaults for you, change the CMD if you do not use aws-okta anymore | |
NAME_PREFIX="${1:-test}"; shift; | |
SUBJECT="${1:-/emailAddress=eng.oncall@example.com/O=ExampleOrg/OU=SRE/C=US/ST=CA/L=SanDiego}"; shift; | |
AWS_CMD="aws-okta exec labs -- aws"; | |
PARAM_NAME="${1:-/certs/${NAME_PREFIX}/pass}"; | |
DAYS_VALID="3650"; | |
# - in my use case the cert does not have name (CAN or CN) but email address: /emailAddress=eng.oncall@example.com/O=ExampleOrg/OU=SRE/C=US/ST=CA/L=Lodi" \ | |
# if SAN or CN are needed, remove email from the subject and add to the openssl command another argument: | |
# -addext "subjectAltName = DNS:sre.example.com" |
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
# scan network for open ports, list IPs that have something listening on those ports | |
# You can list multiple ports, separate them by commas (22,80,443). | |
function check_port() { NETWORK="$1"; shift; PORTS="$1"; shift; [ -z "$PORTS" ] && echo "Use: check_port CIDR PORTS - scans CIDR, prints ip if it listens on comma separated PORTS." && return 1; nmap --open -p "${PORTS}" "${NETWORK}" -oG - | awk '/\/open/ {print $2 }'; } | |
function check_port() { | |
NETWORK="$1"; shift; | |
PORTS="$1"; shift; |
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 | |
# +--------------------------------- | |
# Enter madtown pw: dd | |
# Sanity check: | |
# default iface en0 | |
# mac_addr 0c:e4:41:d9:63:89 | |
# ip_addr 192.168.1.202 | |
# | |
# Type Y to proceed. |
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
// note: document.get_elementByTagName returns HTMLCollection which is not an array, and does not implement foreach(). | |
// ... turns htmlcolleciton into an array. Array.from(a) would do same here. | |
// This also an example of design decision that did not age well. | |
// ref: https://stackoverflow.com/questions/22754315/for-loop-for-htmlcollection-elements/22754453 or so. | |
[...document.getElementsByTagName('img')].forEach(a=>console.log(a.style.visibility='hidden')) | |
[...document.getElementsByTagName('img')].forEach(a=>console.log(a.style.height='100px')) | |
[...document.getElementsByTagName('img')].forEach(a=>my_function(a)) |
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
function _gitlog_list_committers () { | |
DAYS=${1:-1}; # check last day unless more requested | |
git log --pretty=format:'%<(20)%cn %ce' \ # committer name and email | |
--after=$(date -v "-${DAYS}d" +%F) \ # in the past DAYS | |
--invert-grep --committer='GitHub' \ # just people, no bots | |
--all | \ # all branches | |
sort -u ; | |
} |
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
// userscript parts to pause playback in all open tabs, save for the current one. | |
// handles http video and audio tags, this will pause what is playing. | |
// Swap pause() to play() to reverse. Other controls: | |
// .volume (goes on interval from 0-1.0) | |
// .muted (bool) | |
['video','audio'].forEach((tag)=>{ | |
player = document.getElementsByTagName(tag) | |
if(!![...player].find((e)=>e && !(e.paused && e.ended && e.muted))){ |
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
# https://gist.github.com/marcinantkiewicz/9ac20677145f246eb01cd1759cb03f35 | |
# Author: Marcin Antkiewicz | |
# marcin@kajtek.org | |
# @deciban | |
# Use: | |
#find_chrome_extensions -OutputDir "c:\" | |
#idea ref: https://www.reddit.com/r/PowerShell/comments/5px71w/getting_chrome_extensions/ | |
#PS 2.o has no convertfrom-json, 2.0 helper from http://stackoverflow.com/questions/28077854/powershell-2-0-convertfrom-json-and-convertto-json-implementation |
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
def get_detects(): | |
# other parameters: for pagination: limit (max on page) and offset, and for ordering: sort. I want detections from last 5min. | |
parameters = {"filter":"last_behavior:>'now-5m'"} | |
d = detects.Detects(creds={ 'client_id': cid,'client_secret': key}) | |
response = d.QueryDetects(parameters) | |
if response: | |
if response['body']['meta']['pagination']['total'] > 0: | |
return response['body']['resources'] | |
else: |
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
# tls has to be enabled on :443 so that the connection can be terminated there before the redirect is sent back. | |
$SERVER["socket"] == ":80" { | |
$HTTP["host"] =~ ".*" { | |
url.redirect = (""=>"https://%0:8443/manage/site/default/dashboard") | |
} | |
} | |
$SERVER["socket"] == ":443" { | |
$HTTP["host"] =~ ".*" { |