Skip to content

Instantly share code, notes, and snippets.

View svc64's full-sized avatar
🎯

Asaf svc64

🎯
  • Israel
View GitHub Profile
@svc64
svc64 / mac_mem_rw.cpp
Last active December 7, 2021 09:36
executable memory r/w on macOS
// (c) svc64 29/11/2021
// should, in theory, work on iOS <~14.4 or with the correct jailbreak modifications (and the correct breakpoint opcode in main() here)
#include <unistd.h>
#include <errno.h>
#include <sys/mman.h>
#include <mach/mach.h>
#include <mach/mach_vm.h>
mach_vm_size_t page_size;
uintptr_t get_rw_copy(uintptr_t src_address) {
@svc64
svc64 / hooks.cpp
Created December 15, 2021 15:27
very very unsafe hooking on macOS
/*
(c) svc64 - 2021
very very unsafe hooks.
don't use this in prod.
seriously.
write something better than this.
if you do use this, keep in mind that we're doing a bunch of syscalls and writing code to "restore" a function, this is NOT thread safe at all. your app WILL *eventually* crash if you do this on multiple threads (experience from nightmares in prod).
just don't fucking use this, do something smarter tnxbye.
*/
SHA512SUM: 5d8f7548237878d002d66a3233769e3e901a6898a1ee7d3a8b9cfe26f124d480ba6adfdd643397e18af11d316846220fda262f1b9b61e749bbd77431648a87f7
@svc64
svc64 / override.conf
Last active June 28, 2022 17:12
Tailscale + Wireguard VPN on the same server
# ip rule
0: from all lookup local
5208: from all lookup main suppress_prefixlength 0
5209: not from all fwmark 0xca6c lookup 51820 # <--- WireGuard's rule
5210: from all fwmark 0x80000 lookup main
5230: from all fwmark 0x80000 lookup default
5250: from all fwmark 0x80000 unreachable
5270: from all lookup 52
32766: from all lookup main
32767: from all lookup default
@svc64
svc64 / f36_alienware.md
Created September 9, 2022 09:07
Fedora 36 (KDE) on an Alienware 17 R3
  • Install Fedora 36 and reboot. Make sure to prevent the screen from turning off at this point as that will completely hang the system.

    • Settings -> Power Management -> Energy Saving:

      • Unselect "Dim Screen", "Screen Energy Saving" and "Suspend session"
  • Add i915.disable_power_well=0 to GRUB_CMDLINE_LINUX in /etc/default/grub

  • This will make the laptop display turn off without crashing your system.

@svc64
svc64 / addbr0ubunmcli.md
Created April 8, 2023 09:23 — forked from plembo/addbr0ubunmcli.md
Add br0 to Ubuntu desktop using nmcli

Add a bridge interface to Ubuntu desktop using nmcli

Had to do this for some advanced networking with KVM, and couldn't figure out how to do it using the Nework Manager gui. Did find an article later that showed how to do it with nmtui, but it's so much easier to record what you did when using the cli.

To see what everything looks like before starting:

$ nmcli con show
@svc64
svc64 / nmbrnetkvm.md
Created April 8, 2023 09:23 — forked from plembo/nmbrnetkvm.md
NetworkManager bridged network for KVM guests

Setting up a bridged network for KVM guests

This will work with either networkd or NetworkManager as a resolver. In fact, this is the only way to do bridged KVM (libvirtd) networking with NetworkManager.

If you're using NetworkManager (on a desktop or laptop, for example) on your KVM host, follow these instructions to set up a bridge interface.

Once you have the host bridge set up, proceed as follows:

  1. Create a bridge network device inside KVM. Edit and save the below text as file host-bridge.xml:
[Unit]
Description=Wait for tailscale to be available
After=tailscaled.service
Requires=tailscaled.service
[Service]
Type=oneshot
ExecStart=/usr/bin/bash -c 'until /usr/bin/ping -qW 1 -c1 truenas; do sleep 1; done'
RemainAfterExit=yes
Timeout=30
@svc64
svc64 / mount_nfs.service
Created February 29, 2024 18:37
nfs mounting lol
[Unit]
Description=Mount NFS share
After=networking.service
Requires=networking.service
[Service]
Type=oneshot
ExecStart=/root/mount_nfs.sh
RemainAfterExit=yes
Timeout=30
# /usr/lib/systemd/system/docker.service.d/override.conf
# mount your share with "defaults,hard,_netdev"
[Unit]
After=remote-fs.target
Wants=remote-fs.target