Skip to content

Instantly share code, notes, and snippets.

@Manouchehri
Manouchehri / optimal_mtu.md
Created July 12, 2022 16:37 — forked from nitred/optimal_mtu.md
Wireguard Optimal MTU

About

  • I faced bandwidth issues between a WG Peer and a WG server. Download bandwidth when downloading from WG Server to WG peer was reduced significantly and upload bandwidth was practically non existent.
  • I found a few reddit posts that said that we need to choose the right MTU. So I wrote a script to find an optimal MTU.
  • Ideally I would have liked to have run all possible MTU configurations for both WG Server and WG Peer but for simplicity I choose to fix the WG Server to the original 1420 MTU and tried all MTUs from 1280 to 1500 for the WG Peer.

Testing

  • On WG server, I started an iperf3 server
  • On WG peer, I wrote a script that does the following:
    • wg-quick down wg0
  • Edit MTU in the /etc/wireguard/wg0.conf file
@Manouchehri
Manouchehri / raspberry-pi-zero_as_webcam.md
Created March 31, 2022 11:52 — forked from justinschuldt/raspberry-pi-zero_as_webcam.md
Directions for setting up a RaspberryPi to act as a generic USB webcam

hardware/software

Webcam parts:

  • Raspberry Pi Zero W Rev 1.1
  • Raspberry Pi Camera v2 (8-megapixel)
  • Raspberry Pi High Quality Camera (12.3-megapixel)
  • Raspbian Buster Lite 2020-02-13

Webcam works with:

  • Windows 10
  • Windows 10 "Camera" app
@Manouchehri
Manouchehri / centos8-chroot.sh
Created March 15, 2022 15:43 — forked from snixon/centos8-chroot.sh
Build a centos8 AWS AMI in a chroot
#!/bin/bash -ex
# Build a new Centos8 install on EBS volume in a chroot
# Run from RHEL8 or CentOS8 instance - eg: ami-0c322300a1dd5dc79 in us-east-1 (RHEL 8 official image)
# Script expects a second EBS volume, I add them as /dev/sdf in the console
# When the script completes, turn the second EBS volume into your new AMI through the console.
# Adjust the section below to match the device names you're using. Defaults are for an m5.large
# m5 series requires the updated device names
@Manouchehri
Manouchehri / sh.sh
Created November 15, 2021 17:30 — forked from scottopell/sh.sh
Embed SRT file into mp4 with ffmpeg
# got this from http://stackoverflow.com/questions/8672809/use-ffmpeg-to-add-text-subtitles
ffmpeg -i infile.mp4 -f srt -i infile.srt -c:v copy -c:a copy -c:s mov_text outfile.mp4
# confirmed working with the following ffmpeg
# (installed using `brew 'ffmpeg', args: ['with-libvorbis', 'with-libvpx']` )
ffmpeg version 3.1.2 Copyright (c) 2000-2016 the FFmpeg developers
built with Apple LLVM version 7.3.0 (clang-703.0.31)
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.1.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libxvid --enable-libvorbis --enable-libvpx --disable-lzma --enable-vda
@Manouchehri
Manouchehri / isolate.sh
Created September 18, 2021 22:43 — forked from cynecx/isolate.sh
wireguard & netns (crappy)
#!/usr/bin/env bash
set -e -o pipefail
shopt -s extglob
export LC_ALL=C
CONTAINER=""
INTER_GATEWAY="192.168.30.0/24"
INTER_IP_HOST="192.168.30.1/32"
INTER_IP_CONT="192.168.30.2/32"
From a4a400549761cba03af4a6a14caeb3785255a1e3 Mon Sep 17 00:00:00 2001
From: Joey Jiao <[email protected]>
Date: Sun, 27 Oct 2019 13:39:43 +0800
Subject: [PATCH] AFL: Enable AFL by global paths
Change-Id: Iede00c60802f7b4856cde6d3b3c27201a68f3e5f
---
android/config.go | 21 +++++++++++++++++++++
android/variable.go | 4 ++++
cc/builder.go | 11 +++++++++++
@Manouchehri
Manouchehri / 1.js
Created April 21, 2021 21:07 — forked from getify/1.js
demonstrating how to use "nodegit" to modify and read from a local bare git repo
/*
NOTE: This code assumes a bare git repo in ./bare-git/,
which should have at least one text file in its root,
named "greetings.txt".
This code updates the contents of a "greetings.txt"
file, and creates a new file called "greetings-XXX.txt"
(with XXX being a random number). It then creates a new
commit for these changes. Finally, it reads and dumps
the new current contents of the repo, file by file.
@Manouchehri
Manouchehri / 0-enp2s0.network
Created February 12, 2021 22:39 — forked from cloudnull/0-enp2s0.network
Compute node systemd-networkd setup with bonding
[Match]
Name = enp2s0
[Network]
Address = 172.16.25.52/22
@Manouchehri
Manouchehri / zram-ubuntu-1804.md
Created December 6, 2020 19:12 — forked from rizalp/zram-ubuntu-1804.md
Zram Ubuntu 1804
  • sudo apt install zram-config, this will install several files, including systemd startup /etc/systemd/system/multi-user.target.wants/zram-config.service
  • sudo nano /usr/bin/init-zram-swapping and edit:
#!/bin/sh

# load dependency modules
NRDEVICES=1
if modinfo zram | grep -q ' zram_num_devices:' 2>/dev/null; then
 MODPROBE_ARGS="zram_num_devices=${NRDEVICES}"
@Manouchehri
Manouchehri / gist:d7b72f7162665874d7fb8e9dc25923ff
Created February 21, 2020 17:42 — forked from 9thplayer/gist:df042fe48c314dbc1afad80ffed8387d
Hitron Router - CODA - 4582U - 7.1.1.30 - Stored XSS Vulnerability
Hitron CODA-4582U 7.1.1.30 devices allow XSS via a Managed Device name on the > Wireless > Access Control > Add Managed Device screen.
Impact:
Script can be stored in Database and execute every time when users visits it. If an attacker can control a script that is executed in the victim's browser, then they can typically fully compromise that user.
Amongst other things, the attacker can:
1) Perform any action within the application that the user can perform.
2) View any information that the user is able to view.
3) Modify any information that the user is able to modify.
4) Initiate interactions with other application users, including malicious attacks, that will appear to originate from the initial victim user.