Skip to content

Instantly share code, notes, and snippets.

View ph1048's full-sized avatar
🎯
Focusing

Alex ph1048

🎯
Focusing
View GitHub Profile
package nospike
import (
"bufio"
"errors"
"fmt"
"io/ioutil"
"log"
"os"
"path/filepath"
@ph1048
ph1048 / .zshrc
Last active April 25, 2023 11:44 — forked from Anon-Exploiter/.zshrc
.zshrc of Kali Linux 2020.3 including the lit prompt
# ~/.zshrc file for zsh non-login shells.
# see /usr/share/doc/zsh/examples/zshrc for examples
setopt autocd # change directory just by typing its name
#setopt correct # auto correct mistakes
setopt interactivecomments # allow comments in interactive mode
setopt ksharrays # arrays start at 0
setopt magicequalsubst # enable filename expansion for arguments of the form ‘anything=expression’
setopt nonomatch # hide error message if there is no match for the pattern
setopt notify # report the status of background jobs immediately
@ph1048
ph1048 / sources.list
Created January 2, 2022 16:16 — forked from josephlr/sources.list
/etc/apt/sources.list for Ubuntu Bionic 18.04
deb [arch=amd64,i386] http://us.archive.ubuntu.com/ubuntu/ bionic main restricted universe multiverse
deb [arch=amd64,i386] http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted universe multiverse
deb [arch=amd64,i386] http://us.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
deb [arch=amd64,i386] http://security.ubuntu.com/ubuntu bionic-security main restricted universe multiverse
deb [arch=arm64,armhf,ppc64el,s390x] http://ports.ubuntu.com/ubuntu-ports/ bionic main restricted universe multiverse
deb [arch=arm64,armhf,ppc64el,s390x] http://ports.ubuntu.com/ubuntu-ports/ bionic-updates main restricted universe multiverse
deb [arch=arm64,armhf,ppc64el,s390x] http://ports.ubuntu.com/ubuntu-ports/ bionic-backports main restricted universe multiverse
deb [arch=arm64,armhf,ppc64el,s390x] http://ports.ubuntu.com/ubuntu-ports/ bionic-security main restricted universe multiverse
@ph1048
ph1048 / google_photos_takeout_metadata_resolver.py
Created December 22, 2021 13:52 — forked from tetebueno/google_photos_takeout_metadata_resolver.py
Google Photos Takeout archive holds a JSON file with photo/video metadata, thing is that the naming for this JSON file is not always so obvious. This takes care of resolving the name with all the variants I found so far.
import re as _re
import json as _json
JSON_EXTENSION = '.json'
def find_json_for_file(file: Path):
try:
if file.with_name(file.name + JSON_EXTENSION).is_file():
# file.jpg -> file.jpg.json
the_json_path = file.with_name(file.name + JSON_EXTENSION)
@ph1048
ph1048 / enable_ebpf_on_wsl2
Created December 15, 2021 03:09 — forked from MarioHewardt/enable_ebpf_on_wsl2
Enable EBPF on WSL2
By default, EBPF programs will not run on WSL2 due to required kernel modules missing. The following example error is an
indication of this problem:
modprobe: ERROR: ../libkmod/libkmod.c:586 kmod_search_moddep() could not open moddep file '/lib/modules/4.19.84-microso
ft-standard/modules.dep.bin'
modprobe: FATAL: Module kheaders not found in directory /lib/modules/4.19.84-microsoft-standard
chdir(/lib/modules/4.19.84-microsoft-standard/build): No such file or directory
To fix this you need to rebuild the WSL2 kernel with the missing kernel modules. The below instructions are for Ubuntu 18.04 WSL2.
1. git clone https://github.com/microsoft/WSL2-Linux-Kernel.git
@ph1048
ph1048 / userconfig.cfg
Created November 13, 2021 12:47
switch xash3d control config
unbindall
// - button
bind BACK "toggleconsole"
// + button
bind START "escape"
// Left stick press
bind STICK1 "+speed"
// Right stick press
bind STICK2 ""
// L button
@ph1048
ph1048 / mount_qcow2.md
Created August 22, 2021 13:01 — forked from shamil/mount_qcow2.md
How to mount a qcow2 disk image

How to mount a qcow2 disk image

This is a quick guide to mounting a qcow2 disk images on your host server. This is useful to reset passwords, edit files, or recover something without the virtual machine running.

Step 1 - Enable NBD on the Host

modprobe nbd max_part=8
@ph1048
ph1048 / gist:e05bb419857e3dd937d7de6b30409f48
Created July 7, 2021 06:42
transmission remote handler
"C:\Program Files\Transmission\transmission-remote.exe" 192.168.x.x:9999 -a %1
pause
@ph1048
ph1048 / gist:b8743b180e423383741fbaff37c255d1
Created May 1, 2021 22:06
keenetic port knocking for vpn
#!/bin/sh
[ "$table" != "filter" ] && exit 0
/opt/sbin/ipset create knockd hash:ip -exist
/opt/sbin/iptables -I _NDM_IP_PUBLIC -p udp --dport 1701 -j DROP
/opt/sbin/iptables -I _NDM_IP_PUBLIC -p udp --dport 500 -j DROP
/opt/sbin/iptables -I _NDM_IP_PUBLIC -p udp --dport 4500 -j DROP
/opt/sbin/iptables -I _NDM_IP_PUBLIC -m set --match-set knockd src -p udp --dport 1701 -j ACCEPT
/opt/sbin/iptables -I _NDM_IP_PUBLIC -m set --match-set knockd src -p udp --dport 500 -j ACCEPT
@ph1048
ph1048 / pci-passthrough.md
Created January 4, 2021 00:02 — forked from ulkeshkosh/pci-passthrough.md
PCI-Passthrough Rig, OS, and Setup

Introduction

This is my guide for a successful PCI-Passthrough from Linux (Arch Linux) to QEMU/KVM via virt-manager and libvirtd into a Windows 10 Home guest.

NOTE: This is a guide for Intel only. I do not own an AMD machine, and will not add AMD information this guide until such time that I do, which could be never.

Hardware

Device Type Device
CPU Intel Core i7 7700K Quad-Core, Hyperthreading
Motherboard Gigabyte Z270X-Gaming 5