Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View marcinantkiewicz's full-sized avatar

Marcin Antkiewicz marcinantkiewicz

View GitHub Profile
# 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;
// 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))
#! /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.
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 ;
}
// 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))){
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:
@marcinantkiewicz
marcinantkiewicz / 99-redirect-to-unifi.conf
Created February 18, 2021 17:29
lighttpd: redirect default ports to the unifi controller
# 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"] =~ ".*" {
//will miss cookies with httpOnly attribute set
function printCookie(match){
var cookies = document.cookie.split(";");
var cookie = {};
for (var i=0; i<cookies.length; i++){
header = cookies[i].trim();
marker = header.indexOf("=");
name = header.substr(0,marker);
value = header.substr(marker+1);

Note, a lot of content here is from SIRA lists/posts. If you are interested in the topic, please join SIRA.

TODO

  • Group items in a sane way.
  • The papers probably should be listed in a quotable format of some standard. Same with books?
  • This list grew a bit big, probably should be split into separate lists per category. I started listing by person, but it probably makes no sense.
  • The books and podcasts are the only lists that I think are substantial. The rest is not even stubs.

Books

Some of the books are available used on Ebay, for a fraction of the Amazon price.

@marcinantkiewicz
marcinantkiewicz / README.md
Created September 12, 2018 15:25 — forked from joyrexus/README.md
collapsible markdown

collapsible markdown?

CLICK ME

yes, even hidden code blocks!

print("hello world!")