Skip to content

Instantly share code, notes, and snippets.

View lattice0's full-sized avatar
🦀

Lattice 0 lattice0

🦀
View GitHub Profile
@lattice0
lattice0 / gist:c23561ff62af5647c4ac0f3d8d26a739
Last active March 28, 2024 06:29
Vstarcam raspberry pi IP finder and HTTP port
#Give an IP address in the range of the camera to the eth0 interface
sudo ip address add 192.168.1.133/24 dev eth0
#First, scan the eth0 interface to find all the IPs connected to it
nmap -e eth0 192.168.1.0/24
#Now that you found the camera's IP, scan which ports are open to find the HTTP port (suupose the IP is ...189)
nmap -e eth0 192.168.1.104 -p 0-65535
#SSH and foward the HTTP port of the discovered camera
#For copy/paste to work:
sudo apt-get install -y spice-vdagent
#Restart and it should work. If not, try launching it, or activating the service:
spice-vdagent
spice-vdagentd
#Reboot, then do
ps -e | grep spice
#You should see both running
@lattice0
lattice0 / gist:3ac989bfd57f753793dd6d19a0809e59
Last active September 26, 2020 07:42
socat android studio tunnel
Install socat on host and vm
#on virtual machine:
#socat tcp-listen:5037,bind=localhost,reuseaddr,fork tcp:192.168.122.1:5037
#automatic installation on startup:
echo -e '#!/bin/bash\nsocat tcp-listen:5037,bind=localhost,reuseaddr,fork tcp:192.168.122.1:5037 &' | sudo tee --append /etc/rc.local && sudo chmod 755 /etc/rc.local
#on host machine, use with ./script.sh 99 for example
socat tcp-listen:5037,bind=192.168.122.1,reuseaddr,fork tcp:localhost:5037 & socat tcp-listen:19000,bind=localhost,reuseaddr,fork tcp:192.168.122.$1:19000 &
#Then
#On host machine
iptables -F
iptables -F -t nat
echo 1 >| /proc/sys/net/ipv4/ip_forward
iptables -t nat -A PREROUTING -p tcp -d 192.168.122.1 --dport 5037 -j DNAT --to localhost:5037
iptables -t nat -A PREROUTING -p tcp -d localhost --dport 19000 -j DNAT --to 192.168.122.99:19000
iptables -t nat -A POSTROUTING -j MASQUERADE
#On virtual machine
iptables -F
sudo ufw --force reset
sudo ufw default deny incoming # Use the VPN tunnel for all traffic
sudo ufw default deny outgoing
sudo ufw allow out on tun0
sudo ufw allow in on tun0
sudo ufw allow out 1194/udp # e.g. 1234/udp, depending on your OpenVPN client config
@lattice0
lattice0 / ufw dynamic host
Last active April 25, 2018 02:34
ufw rule for dynamic host. Usage
#!/bin/bash
HOSTNAME=dynamichost.domain.com
LOGFILE=$HOME/ufw$HOSTNAME.log
Current_IP=$(host $HOSTNAME | head -n1 | cut -f4 -d ' ')
if [ ! -f $LOGFILE ]; then
/usr/sbin/ufw allow from $Current_IP to any port 22 proto tcp
/usr/sbin/ufw allow from any to $Current_IP port 22 proto tcp
echo $Current_IP > $LOGFILE
else
---
drivers/nvme/host/nvme.h | 5 +++++
drivers/nvme/host/pci.c | 10 ++++++++++
2 files changed, 15 insertions(+)
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index 8e4550fa08f8..e970423b7944 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -83,6 +83,11 @@ enum nvme_quirks {
---
drivers/pci/pcie/aspm.c | 14 ++++++++++----
drivers/pci/quirks.c | 9 ++++++++-
include/linux/pci-aspm.h | 1 +
3 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index 3b9b4d50cd98..9434382d26dc 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@lattice0
lattice0 / gist:e3159b93afd94d05e22d0699240d94a4
Last active July 7, 2019 12:16
how to download ubuntu kernel and patch it
sudo apt-get install dpkg-dev
#https://askubuntu.com/questions/496549/error-you-must-put-some-source-uris-in-your-sources-list
sudo apt-get build-dep gawk
sudo nano /etc/apt/sources.list
deb-src http://security.ubuntu.com/ubuntu bionic-security main
sudo apt-get source linux-souce...
apt-get source linux #why this works??
sudo apt-get build-dep linux-image-$(uname -r)
tar -xzvf archive.tar.gz
cd kernel_source_directory
cpio: /home/vm/linux-4.15/debian/linux-headers-4.15.0-23/usr/src/linux-headers-4.15.0-23/arch/parisc/include/asm/Kbuild not created: newer or same age version exists
cpio: /home/vm/linux-4.15/debian/linux-headers-4.15.0-23/usr/src/linux-headers-4.15.0-23/arch/nios2/include/uapi/asm/Kbuild not created: newer or same age version exists
cpio: /home/vm/linux-4.15/debian/linux-headers-4.15.0-23/usr/src/linux-headers-4.15.0-23/arch/nios2/include/asm/Kbuild not created: newer or same age version exists
cpio: /home/vm/linux-4.15/debian/linux-headers-4.15.0-23/usr/src/linux-headers-4.15.0-23/arch/c6x/include/uapi/asm/Kbuild not created: newer or same age version exists
cpio: /home/vm/linux-4.15/debian/linux-headers-4.15.0-23/usr/src/linux-headers-4.15.0-23/arch/c6x/include/asm/Kbuild not created: newer or same age version exists
cpio: /home/vm/linux-4.15/debian/linux-headers-4.15.0-23/usr/src/linux-headers-4.15.0-23/arch/openrisc/include/uapi/asm/Kbuild not created: newer or same age version exists
cpio: /home/vm/linu