Skip to content

Instantly share code, notes, and snippets.

View mps-failing.go
package main
import (
"bytes"
"context"
"fmt"
log "github.com/sirupsen/logrus"
"github.com/telanflow/mps"
"io/ioutil"
"net"
View zap-header-inject-script.js
function sendingRequest(origMsg, initiator, helper)
{
// skip if it isn't for the API scope
if (! origMsg.getRequestHeader().getHostName().contains("mywebapi")) { return; }
var httpRequestHeader = origMsg.cloneAll().getRequestHeader();
// add the Accept header if not exists
if (origMsg.getRequestHeader().getHeader("Accept") == null)
{
View MTLSBackendHandler.java
package tls.netty;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
public class MTLSBackendHandler
extends ChannelInboundHandlerAdapter
{
@hazcod
hazcod / ttlmap.go
Created Sep 15, 2020
Go sync.map with TTL and per-second scavenging
View ttlmap.go
type TTLMap struct {
TTL time.Duration
data sync.Map
}
type expireEntry struct {
ExpiresAt time.Time
Value interface{}
}
@hazcod
hazcod / plexdrive.service
Created Aug 25, 2020
plexdrive systemd settings
View plexdrive.service
#### systemd script (/etc/systemd/system/plexdrive.service):
[Unit]
Description=Plexdrive
AssertPathIsDirectory=/media/plex/
After=network-online.target
### CONFIGURED FOR MAX ~58GB of MEMORY (change max-chunks to lower)
@hazcod
hazcod / osquery-queries.json
Created Jun 16, 2020
osquery queries extracted from kolide.
View osquery-queries.json
{
"options": {
"disable_audit": false,
"disable_events": false,
"enable_mouse_events": false,
"enable_keyboard_events": false,
"events_max": 10000,
"events_expiry": 3600,
"read_max": 52428800,
"logger_event_type": false,
@hazcod
hazcod / plex.sh
Last active May 12, 2020
Sonarr & Plex plex scanner.
View plex.sh
#!/usr/bin/env bash
type="$1"
PLEXSCAN="/Applications/Plex Media Server.app/Contents/MacOS/Plex Media Scanner"
if [ "$type" != "Series" ] && [ "$type" != "Movies" ]; then
echo "Unknown type: $type"
exit 1
fi
@hazcod
hazcod / port-scanner.go
Last active Apr 21, 2020
Simple port scanner. Scans full host in 24sec.
View port-scanner.go
package main
import (
"context"
"fmt"
"github.com/pkg/errors"
"net"
"strings"
"sync"
"syscall"
@hazcod
hazcod / telenet-modem-firewall.txt
Created Mar 26, 2020
Telenet modem firewall ruleset.
View telenet-modem-firewall.txt
# Generated by iptables-save v1.4.21 on Sun Jan 19 08:14:54 2020
*raw
:PREROUTING ACCEPT [17478:786616]
:OUTPUT ACCEPT [15285:6842393]
COMMIT
# Completed on Sun Jan 19 08:14:54 2020
# Generated by iptables-save v1.4.21 on Sun Jan 19 08:14:54 2020
*nat
:PREROUTING ACCEPT [412:43501]
:INPUT ACCEPT [54:3686]
@hazcod
hazcod / github-archive-org.sh
Created Nov 28, 2019
Clone all your organization repositories on GitHub.
View github-archive-org.sh
#!/usr/bin/env bash
# will ask for your personal access token
GH_USER=""
GH_ORG=""
curl -u "${GH_USERNAME}" -s "https://api.github.com/orgs/${GH_ORG}/repos?per_page=200" | ruby -rubygems -e 'require "json"; JSON.load(STDIN.read).each { |repo| %x[git clone #{repo["ssh_url"]} ]}'
You can’t perform that action at this time.