Skip to content

Instantly share code, notes, and snippets.

@akissu
akissu / arch.conf
Created January 28, 2019 05:23
Config files to perform PCI passthrough over Thunderbolt
title enter da virtual w0r1d
linux /vmlinuz-linux
initrd /intel-ucode.img
initrd /initramfs-linux.img
options cryptdevice=UUID=a403fa05-b3c1-4d3e-864b-f3158ab74abc:root root=/dev/mapper/root intel_iommu=on iommu=pt rd.driver.pre=vfio-pci vfio-pci.ids=10de:1b81,10de:10f0,8086:15b6
#iommu_groups | grep -e "Group 13" -e "Group 14"
#IOMMU Group 13 03:00.0 PCI bridge [0604]: Intel Corporation DSL6340 Thunderbolt 3 Bridge [Alpine Ridge 2C 2015] [8086:1576]
#IOMMU Group 13 04:00.0 System peripheral [0880]: Intel Corporation DSL6340 Thunderbolt 3 NHI [Alpine Ridge 2C 2015] [8086:1575]
#IOMMU Group 14 03:01.0 PCI bridge [0604]: Intel Corporation DSL6340 Thunderbolt 3 Bridge [Alpine Ridge 2C 2015] [8086:1576]
#!/bin/bash
#
cd /local/backups || exit 1
export PATH=/usr/local/sbin:/usr/local/bin:$PATH
BACKUPDEST="$1"
DOMAIN="$2"
MAXBACKUPS="$3"
PASSWD="/* change this, obviously */"
@nrocco
nrocco / README.md
Last active December 15, 2023 00:41
Alpine Playground with libvirt

First download alpine-make-vm-image from https://github.com/alpinelinux/alpine-make-vm-image

wget https://raw.githubusercontent.com/alpinelinux/alpine-make-vm-image/v0.4.0/alpine-make-vm-image \
    && echo '5fb3270e0d665e51b908e1755b40e9c9156917c0  alpine-make-vm-image' | sha1sum -c \
    || exit 1
mv alpine-make-vm-image /usr/local/bin/
chmod +x /usr/local/bin/alpine-make-vm-image

Create a new alpine qcow2 image

@DavidBuchanan314
DavidBuchanan314 / cursed_mandelbrot.c
Last active June 28, 2023 15:12
Compile-time mandelbrot in pure C. Outputs a PGM image file to stdout. Output can be seen at https://twitter.com/David3141593/status/1062468528115200001
#include <stdio.h>
#define SQ(x) (x)*(x)
#define M0(x,y) SQ(x)+SQ(y)<4?0:0xe0
#define M1(x,y,x0,y0) (SQ(x)+SQ(y)<4)?M0(SQ(x)-SQ(y)+(x0),2*(x)*(y)+(y0)):0xc0
#define M2(x,y,x0,y0) (SQ(x)+SQ(y)<4)?M1(SQ(x)-SQ(y)+(x0),2*(x)*(y)+(y0),x0,y0):0xa0
#define M3(x,y,x0,y0) (SQ(x)+SQ(y)<4)?M2(SQ(x)-SQ(y)+(x0),2*(x)*(y)+(y0),x0,y0):0x80
#define M4(x,y,x0,y0) (SQ(x)+SQ(y)<4)?M3(SQ(x)-SQ(y)+(x0),2*(x)*(y)+(y0),x0,y0):0x60
#define M5(x,y,x0,y0) (SQ(x)+SQ(y)<4)?M4(SQ(x)-SQ(y)+(x0),2*(x)*(y)+(y0),x0,y0):0x40
@ChristopherA
ChristopherA / git-submodule-tips.md
Last active May 24, 2024 10:24
`git submodule` Tips #git #submodule

git submodule Tips

To clone a repo with submodules

git clone --recursive [email protected]:url_to/awesome_submodule.git path_to_awesome_submodule

Add a submodule clone into an existing repo

git submodule add [email protected]:url_to/awesome_submodule.git path_to_awesome_submodule
@hacst
hacst / CMakeLists.txt
Created June 5, 2018 23:18
Basic Systemd sd_notify + watchdog usage
cmake_minimum_required(VERSION 2.8)
project(sdnotify)
add_executable(sdnotify sdnotify.cpp)
target_link_libraries(sdnotify PUBLIC systemd)
@nadavrot
nadavrot / Matrix.md
Last active April 20, 2025 12:59
Efficient matrix multiplication

High-Performance Matrix Multiplication

This is a short post that explains how to write a high-performance matrix multiplication program on modern processors. In this tutorial I will use a single core of the Skylake-client CPU with AVX2, but the principles in this post also apply to other processors with different instruction sets (such as AVX512).

Intro

Matrix multiplication is a mathematical operation that defines the product of

@jhaddix
jhaddix / cloud_metadata.txt
Last active April 24, 2025 20:06 — forked from BuffaloWill/cloud_metadata.txt
Cloud Metadata Dictionary useful for SSRF Testing
## AWS
# from http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html#instancedata-data-categories
http://169.254.169.254/latest/user-data
http://169.254.169.254/latest/user-data/iam/security-credentials/[ROLE NAME]
http://169.254.169.254/latest/meta-data/iam/security-credentials/[ROLE NAME]
http://169.254.169.254/latest/meta-data/ami-id
http://169.254.169.254/latest/meta-data/reservation-id
http://169.254.169.254/latest/meta-data/hostname
http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key
@Neo23x0
Neo23x0 / audit.rules
Last active March 11, 2025 10:24
Linux Auditd Best Practice Configuration
# IMPORTANT!
# This gist has been transformed into a github repo
# You can find the most recent version there:
# https://github.com/Neo23x0/auditd
# ___ ___ __ __
# / | __ ______/ (_) /_____/ /
# / /| |/ / / / __ / / __/ __ /
# / ___ / /_/ / /_/ / / /_/ /_/ /
# /_/ |_\__,_/\__,_/_/\__/\__,_/