Skip to content

Instantly share code, notes, and snippets.

View amboxer21's full-sized avatar

Anthony Guevara amboxer21

  • Brick, New Jersey 08723
View GitHub Profile
@amboxer21
amboxer21 / ps4_remote_play_wan.sh
Last active January 6, 2020 02:34
iptable rules for my 1200ac openwrt router to allow remote play on Chiaki
IPADDR='192.168.1.224'
SOURCE='192.168.1.0/24'
for PORT in 80 443 9295; do
iptables -I FORWARD -p tcp ! --source $SOURCE -d $IPADDR --dport $PORT -j ACCEPT ;
iptables -I PREROUTING -t nat -p tcp ! --source $SOURCE --dport $PORT -j DNAT --to $IPADDR:$PORT ;
done
for PORT in 9296 9297; do
iptables -I FORWARD -p udp ! --source $SOURCE -d $IPADDR --dport $PORT -j ACCEPT ;
ALL DATA IS LIVE!! I applied to algorithm against the rails logger debugging output, then compared the results against the GUI output.
** GUI OUTPUT **
--------------------------------------------------------------------
Date Start End Duration
Jun 29 2019 11:56:34 PM 11:56:50 PM 16s
Jun 30 2019 11:22:01 PM 11:22:57 PM 56s
Jul 1 2019 12:55:32 AM 12:56:10 AM 38s
Jul 2 2019 02:12:00 AM 02:28:58 AM 16 minutes 58 seconds
anthony@anthony:~$ cat /etc/pulse/client.conf | egrep -v '^(;|#|$)'
autospawn = no
extra-arguments = -vvvv --log-target=file:/tmp/pulseaudio.log --log-time=1
anthony@anthony:~$
anthony@anthony:~$ cat /etc/pulse/daemon.conf | egrep -v '^(;|#|$)'
log-target = file:/tmp/pulseaudio.log
log-level = debug
log-meta = yes
@amboxer21
amboxer21 / socket_test.sh
Created April 24, 2019 17:53
A bash script that restarts a python script once it's purposely crashed when fed a specific string.
#!/bin/bash
SLEEPSECS=4
CDRDBINDIR=/home/anthony
LOGFILE=$CDRDBINDIR/test.log
PRIORITY=0
MACHINE=`hostname`
message() {
echo "$1" >&2
@amboxer21
amboxer21 / socket_test.py
Last active April 24, 2019 20:05
A python socket made to purposely crash when fed a specific string. Used for testing a daemon script.
#!/usr/bin/python
import time
import socket
class Test(object):
@staticmethod
def test_method():
@amboxer21
amboxer21 / guide.md
Last active March 12, 2019 17:34 — forked from mikkeloscar/guide.md
Setup armv7h chroot under x86_64 host (Archlinux/Archlinuxarm biased)

Setup armv7h chroot under x86_64 host

Simple way to setup an arm chroot for building packages for your arm devices. This is an alternative to cross-compiling where you are limited to only linking against the libs in your toolchain.

Setup chroot-fs

You can store the chroot wherever you like. I choose to store it in a disk-image which I mount to my filesystem.

anthony@anthony ~/Documents/ZIPs/Realtek_RTS5229_Linux_Driver_v1.07/rts5229 $ eix -I linux
[I] sys-apps/util-linux
Available versions: 2.33-r1 ~2.33.1 **9999 {build caps +cramfs fdformat kill ncurses nls pam python +readline selinux slang static-libs +suid systemd test tty-helpers udev unicode ABI_MIPS="n32 n64 o32" ABI_PPC="32 64" ABI_S390="32 64" ABI_X86="32 64 x32" PYTHON_TARGETS="python2_7 python3_4 python3_5 python3_6 python3_7" USERLAND="GNU"}
Installed versions: 2.33-r1(02:23:02 PM 01/07/2019)(cramfs ncurses nls pam readline suid unicode -build -caps -fdformat -kill -python -selinux -slang -static-libs -systemd -test -tty-helpers -udev ABI_MIPS="-n32 -n64 -o32" ABI_PPC="-32 -64" ABI_S390="-32 -64" ABI_X86="64 -32 -x32" PYTHON_TARGETS="python2_7 python3_5 python3_6 -python3_4 -python3_7" USERLAND="GNU")
Homepage: https://www.kernel.org/pub/linux/utils/util-linux/ https://github.com/karelzak/util-linux
Description: Various useful Linux utilities
[U] sys-kernel/li
@amboxer21
amboxer21 / motion_detection_snippet.py
Created February 1, 2019 18:38
logic to run the wifi router connected devices check every 30 seconds while inside a loop that runs every 10th of a second.
# Main process
def capture(self,queue=None):
MotionDetection.lock.acquire()
Logging.log("INFO", "(MotionDetection.capture) - Lock acquired!")
Logging.log("INFO", "(MotionDetection.capture) - MotionDetection system initialized!")
self.camera_motion = cv2.VideoCapture(self.cam_location)

Linux Disk Cloning

The first thing we are going to do is dd the Gentoo OS onto a USB. Download the Gentoo minimal ISO HERE. Alternatively, you can boot off of a Live CD but the focus surrounding this write up will focus on a Live USB medium.

I prefer Gentoo as a live OS but that doesn't mean you have to use Gentoo too. The OS(operating System) does however need to be in ISO format! Which ever OS you chose, you need to DD the ISO to the newly formatted USB drive.

NOTE Each mentioned command should be clickable and will take you to it's manpages. Any word highlighted in blue should be clickable unless its background is grey.

Let's plug in our 2GB USB drive and find it with fdisk

import re
class accepts(object):
@classmethod
def string(cls,func):
if int(func.__code__.co_argcount) < 2:
raise SyntaxError('Methods must be instance methods of a class!')
def wrapper(*args):
for arg in args[1:]:
if not isinstance(arg, str):