Skip to content

Instantly share code, notes, and snippets.

View scmanjarrez's full-sized avatar
🧠
hungry mind

Sergio C scmanjarrez

🧠
hungry mind
  • Spanish National Research Council (CSIC)
  • Madrid
View GitHub Profile
@scmanjarrez
scmanjarrez / nmapBasic2Full.sh
Last active March 28, 2024 16:26
Small script to generate a list of ports to be scanned from the port detected by nmap
#!/bin/bash
declare -a tcp=()
declare -a udp=()
while IFS= read -r line; do
port=$(echo $line | awk '{print $4}')
[[ "$port" =~ "tcp" ]] && tcp+=("${port%%/*}") || udp+=("${port%%/*}")
done < "${1:-/dev/stdin}"
IFS=,
echo -n "-sS -p "
echo "${tcp[*]}"
@scmanjarrez
scmanjarrez / HowToOTGFast.md
Created February 1, 2024 13:36 — forked from gbaman/HowToOTGFast.md
Simple guide for setting up OTG modes on the Raspberry Pi Zero, the fast way!

Setting up Pi Zero OTG - The quick way (No USB keyboard, mouse, HDMI monitor needed)

More details - http://blog.gbaman.info/?p=791

For this method, alongside your Pi Zero, MicroUSB cable and MicroSD card, only an additional computer is required, which can be running Windows (with Bonjour, iTunes or Quicktime installed), Mac OS or Linux (with Avahi Daemon installed, for example Ubuntu has it built in).
1. Flash Raspbian Jessie full or Raspbian Jessie Lite onto the SD card.
2. Once Raspbian is flashed, open up the boot partition (in Windows Explorer, Finder etc) and add to the bottom of the config.txt file dtoverlay=dwc2 on a new line, then save the file.
3. If using a recent release of Jessie (Dec 2016 onwards), then create a new file simply called ssh in the SD card as well. By default SSH i

@scmanjarrez
scmanjarrez / install.sh
Created January 25, 2024 10:19
Install microsoft propietary fonts in linux (calibri, cambria, corbel, etc)
#!/bin/bash
TMPDIR=/tmp/msfonts
mkdir -p $TMPDIR
cd $TMPDIR
wget https://sourceforge.net/projects/mscorefonts2/files/cabs/PowerPointViewer.exe
cabextract -L -F ppviewer.cab -d . PowerPointViewer.exe
cabextract -L -F '*.TT[FC]' -d . ppviewer.cab
@scmanjarrez
scmanjarrez / fix.md
Last active February 3, 2024 11:24
Backup on how to ignore waiting for interfaces with optional: true in netplan (bug)
@scmanjarrez
scmanjarrez / rename.md
Last active January 19, 2024 15:57
wifi rename netplan

During an experiment, I need to use three WiFi interfaces on a Raspberry Pi running Ubuntu 20.04. In addition to Raspberry Pi's internal WiFi interface, I added two USB WiFi adapters. Three network interfaces showed up in the system (ip link command), and they are named wlan0, wlan1, and wlan2 by default.

I often need to capture packets with tcpdump, and I often have to be type these interface names manually. It isn't easy to remember the purpose of each network interface, so I wanted to rename the interfaces to reflect their role in my application. However, this isn't as easy as it sounds.

🚫 Netplan

Ubuntu 20.04 configures network interfaces using Netplan, so my first thought was: I can write a Netplan configuration that matches network interfaces with their MAC addresses, and assigns the desired name to each network interface.

@scmanjarrez
scmanjarrez / tp-link-ac600-ac1300-drivers-linux.md
Created January 18, 2024 18:41 — forked from julianlam/tp-link-ac600-ac1300-drivers-linux.md
Installing drivers for the TP-Link T2U/T3U Plus (AC600 or AC1300) Wireless Adapter #blog
@scmanjarrez
scmanjarrez / overleaf_server_enable_register_community_edition.md
Last active December 6, 2023 20:03
Enable register on Overleaf Server Community Edition (CE)

I'll leave my workaround to enable register for future reference:

  • Start the containers as always

    I'm assuming you're using overleaf toolkit

  • Connect to sharelatex container, we need to copy the following files to /var/lib/sharelatex so we can edit them in the host and bind the new version.
    $ cp app/views/user/register.pug /var/lib/sharelatex
    $ app/src/router.js /var/lib/sharelatex
    $ app/src/Features/User/UserController.js /var/lib/sharelatex
    $ app/src/Features/User/UserPagesController.js /var/lib/sharelatex
@scmanjarrez
scmanjarrez / overleaf_smtp_gmail_community_edition.md
Last active December 6, 2023 19:16
Enable Gmail SMTP on Overleaf Community Edition (CE)

I'll leave my workaround to use with gmail for future reference after testing every suggestion here without success:

  • Define SMTP_USER and SMTP_PASS
       SHARELATEX_EMAIL_SMTP_USER=your_email
       SHARELATEX_EMAIL_SMTP_PASS=app_password # requires 2fa enabled
    
  • Connect to sharelatex container (docker exec) and run this command:
    $ cp /overleaf/services/web/app/src/Features/Email/EmailSender.js /var/lib/sharelatex
@scmanjarrez
scmanjarrez / klippy@extras@gcode_move.py
Last active February 8, 2023 20:15
Code snippet for custom gcodes in klipper to start Tuya Smart Plugs using tinytuya without printer connection
gcode.register_command('TUYA_ON', self.cmd_TUYA_ON, True,
desc=self.cmd_TUYA_ON_help)
gcode.register_command('TUYA_OFF', self.cmd_TUYA_OFF, True,
desc=self.cmd_TUYA_OFF_help)
### ...
### ...
cmd_TUYA_ON_help = "Turn on Tuya Smart Plug"
def cmd_TUYA_ON(self, gcmd):
try:
proc = subprocess.Popen(
@scmanjarrez
scmanjarrez / docker-compose.yaml
Created October 24, 2022 13:58
Esports Capsule Farmer docker compose changes to be used in x86_64: https://github.com/kacperkr90/EsportsCapsuleFarmer
services:
firefox:
restart: always
image: selenium/standalone-firefox:104.0
container_name: selenium_firefox
shm_size: 2g
mem_limit: 512m
mem_reservation: 256m
cpus: 1
ports: