Skip to content

Instantly share code, notes, and snippets.

View Manouchehri's full-sized avatar
🦆

David Manouchehri Manouchehri

🦆
View GitHub Profile
@Manouchehri
Manouchehri / build-cpio
Created February 26, 2024 16:57 — forked from krasCGQ/build-cpio
Scripts to build static-PIE binary of the following; only works on Alpine Linux and other Musl libc based Distros, as some may segfault when done with Glibc.
#!/usr/bin/env dash
#
# SPDX-License-Identifier: Unlicense
#
CC=clang
LD=ld.lld
STRIP=llvm-strip
# -fuse-ld= tells compiler to use specific linker above
@Manouchehri
Manouchehri / pip.md
Created July 27, 2023 18:27 — forked from sillyfrog/pip.md
pip in Jython

To use pip, you must be running Jython v2.7.1 (downloaded from here: http://search.maven.org/remotecontent?filepath=org/python/jython-standalone/2.7.1/jython-standalone-2.7.1.jar). This is not compatible with Esper, so be sure to remove all of these files before upgrading, ie:

rm -rf ./automation/jsr223/000_components/000_Esper.py ./automation/lib/python/esper

With v2.7.1 installed, we can run the Jython from the openHAB installation to install pip

java -jar /openhab/conf/automation/jython/jython-standalone-2.7.1.jar -m ensurepip
@Manouchehri
Manouchehri / SSH_Authentication_TPM2_PKCS11_Arch_Linux.md
Created April 10, 2023 17:47 — forked from p7cq/SSH_Authentication_TPM2_PKCS11_Arch_Linux.md
SSH Authentication with TPM 2.0 and PKCS#11 on Arch Linux

SSH Authentication with TPM 2.0 and PKCS#11 on Arch Linux

Hardware: a TPM 2.0 module based on Infineon SLB9665 cryptographic processor available in the system as /dev/tpmrm0.

Installation

Required software:

# pacman -S tpm2-tools tpm2-pkcs11
@Manouchehri
Manouchehri / hook.js
Created April 7, 2023 02:15 — forked from tony0x59/hook.js
frida script for modify device info in Any iOS App
if (ObjC.available) {
try {
// list methods
// ObjC.classes.XXXClassName.$ownMethods.forEach(function (m) {
// console.log('method: ' + m);
// })
// watch method callstack
// if (1) {
// // -[NSTimeZone secondFromGMT]
@Manouchehri
Manouchehri / mitmproxy_requests_to_csv.py
Created March 14, 2023 19:12 — forked from jasonmfehr/mitmproxy_requests_to_csv.py
Writes mitmproxy data in CSV format to a file
import mitmproxy
from datetime import datetime
import math
class RequestsToCSV:
def load(self, loader):
#
# note: update this path to change the data file name and/or location
#
self.file_handle = open("requests-" + datetime.now().isoformat().split(".")[0] + ".csv", "w")
@Manouchehri
Manouchehri / 1_smime-clients.md
Created January 10, 2023 23:28 — forked from rmoriz/1_smime-clients.md
S/MIME is the industry standard for secure E-Mail and build into every relevant mail client. From Outlook to Thunderbird, from Blackberry to Apple Mail on OSX and iOS. http://smime.io/
@Manouchehri
Manouchehri / intel_x520_patcher.py
Created September 14, 2022 17:37 — forked from ixs/intel_x520_patcher.py
Intel x520 EEPROM Patcher allows to unlock the x520 network card to work with non-intel branded SFP modules.
#!/usr/bin/env python3
#
# Simple Intel x520 EEPROM patcher
# Modifies the EEPROM to unlock the card for non-intel branded SFP modules.
#
# Copyright 2020,2021,2022 Andreas Thienemann <andreas@bawue.net>
#
# Licensed under the GPLv3
#
# Based on research described at https://forums.servethehome.com/index.php?threads/patching-intel-x520-eeprom-to-unlock-all-sfp-transceivers.24634/
@Manouchehri
Manouchehri / parallel
Created July 14, 2022 17:42 — forked from mjambon/parallel
bash: Run parallel commands and fail if any of them fails
#! /usr/bin/env bash
#
# Run parallel commands and fail if any of them fails.
#
set -eu
pids=()
for x in 1 2 3; do
@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