Skip to content

Instantly share code, notes, and snippets.

View megrxu's full-sized avatar
🥝
Learning

megrxu

🥝
Learning
View GitHub Profile
@megrxu
megrxu / [email protected]
Last active July 21, 2020 12:24
Systemd Services
[Unit]
Description=%i service with docker compose
Requires=docker.service
After=docker.service
[Service]
Restart=always
WorkingDirectory=/etc/docker/compose/%i
@megrxu
megrxu / iptables.rules
Created October 22, 2020 02:26
Transparent proxy for TCP using systemd slice and iptables.
*nat
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:TRANS - [0:0]
-A OUTPUT -p tcp -j TRANS
# The proxy is running in `proxy.slice`, so no loop
@megrxu
megrxu / riscv-dump
Last active January 22, 2021 11:09
riscv-dump
#!/bin/env zsh
## Dump machine codes only to a Xilinx coefficient file.
## Usage: ./riscv-dump <.S file> > ROM.coe
## Tmp files
elf=(=())
bin=(=())
## Get the elf