Skip to content

Instantly share code, notes, and snippets.

@mtask
mtask / _srv_tftp_preseed.cfg
Last active January 13, 2024 20:45
Debian PXE boot with preseed
d-i debian-installer/locale string en_US
d-i keyboard-configuration/xkb-keymap select fi
d-i netcfg/choose_interface select auto
d-i netcfg/get_hostname string unassigned-hostname
d-i netcfg/get_domain string unassigned-domain
d-i netcfg/wireless_wep string
d-i mirror/country string manual
d-i mirror/http/hostname string www.nic.funet.fi
d-i mirror/http/directory string /debian
d-i mirror/http/proxy string
@mtask
mtask / pandoc_title_page.txt
Created November 26, 2023 16:18
Pandoc title page example with specific bg color and numbering starting after TOC page
---
title: |
![](logo.png){width=50%}
\newline
\textcolor{white}{Hello There}
header-includes: |
\definecolor{bg}{HTML}{41617d}
\pagecolor{bg}
\setcounter{page}{0}
\pagenumbering{gobble}
@mtask
mtask / README.md
Last active November 23, 2023 20:57
Python csv to markdown table

Convert the following csv syntax to markdown table:

```table
some,csv,data
1,2,3
```

Script csv_md_tables.py will look for "table blocks" and converts the csv content to markdown table. For example, the above content in a markdown file would be converted to this:

@mtask
mtask / stuff.py
Last active September 15, 2023 14:06
stuff
import re
import itertools
RES = []
def xor(var, key):
return bytes(a ^ b for a, b in zip(var, key))
def xorbyte(b):
r = []
@mtask
mtask / docker-nginx
Created August 29, 2023 19:46
docker-nginx apparmor debian
#include <tunables/global>
profile docker-nginx flags=(attach_disconnected,mediate_deleted) {
#include <abstractions/base>
network inet tcp,
network inet udp,
network inet icmp,
@mtask
mtask / config.json
Created May 14, 2023 11:40
opencti stix import
{ "api_url": "http://localhost:8080", "api_token": "<OPENCTI API TOKEN>"}
@mtask
mtask / xyz.py
Last active February 8, 2023 21:14
xyz
import os
import sys
import subprocess
import argparse
import json
def file_types_summary(path):
file_types = {}
for root, dirs, files in os.walk(path):
for f in files:
@mtask
mtask / userprivs.ps1
Created January 29, 2023 14:20
Convert SIDs in usert rights assingments to names
$RESULT = @{}
$OUTFILE = $env:TEMP+"\out.cf"
# Use SecEdit to export USER_RIGHTS configuration
SecEdit.exe /export /areas USER_RIGHTS /cfg $OUTFILE >NULL
# Loop over output file's content
foreach($line in Get-Content -Path $OUTFILE) {
$line_arr = $line.Split(' ')
# Seperate privilige name
$PRIV = $line_arr[0]
# Output contains some other lines as well..
---
- name: Ensure user nginx exists
user:
name: nginx
system: yes
create_home: no
become: yes
- name: Ensure directories for nginx configurations exist
file:
#!/usr/bin/python3
import re
import json
fw_lines = []
def make_dict(str_value):
d = {}
for item in str_value.split():