Skip to content

Instantly share code, notes, and snippets.

View mijorus's full-sized avatar
😎

Lorenzo Paderi mijorus

😎
View GitHub Profile
@mijorus
mijorus / Stream webcam from raspberrypi.md
Last active October 17, 2025 19:33
How to stream a USB webcam from a raspberry pi over the network

How to stream a USB webcam from a raspberry pi over the network

I've struggled with this for a while, but I've finally found a good solution, which has low-latency and good image quality. I'm using a raspberry pi zero 2w with a USB camera.

Use ustreamer

ustreamer is a simple util that allows you to stream a video with very litte latency and a stable 30 fps even from the Pi Zero 2W.

@mijorus
mijorus / smb_raspberry_guide.md
Created August 25, 2025 09:02
SMB Raspberry Pi configuration

Install Samba

 sudo apt install samba samba-common-bin

Edit config file

sudo nano /etc/samba/smb.conf
@mijorus
mijorus / AutoHotSpot.md
Last active September 5, 2025 10:56
Automatically create a Wifi Hotspot on a Raspberry PI if the board is not connected to the internet of PI Zero

With this script, the power LED will start flashing green for 1 minute, signaling that the hotspot is turned on.

You can than connect to it with your PC and login ssh [email protected]

Create an autohotspot.sh under /home/pi

#!/usr/bin/bash

ap_ssid="RaspberryPi-AP"
@mijorus
mijorus / floatStr.js
Created March 16, 2024 12:41
This functions is designed to be used in react inputs to collect float numbers. Given an input string and a decimal separator, it will return a new string with any non-numeric characters removed and only one decimal separator
function floatStr(str, outputDecimalSeparator = ',', possibleSeparators = [',', '.']) {
str = str.replace('.', outputDecimalSeparator);
str = str.replace(',', outputDecimalSeparator);
possibleSeparators.forEach(el => {
str = str.replace(el, outputDecimalSeparator);
});
if (str.startsWith(outputDecimalSeparator)) {
import re
from pprint import pprint
class SambaConfig():
def __init__(self) -> None:
self.data = {}
self.original_raw_data = {}
def get_seciton(self, section: str) -> dict:
@mijorus
mijorus / sleepwatcher.md
Last active July 31, 2025 19:54
Commands for sleepwatcher for turning on and off wifi and bluetooth automatically on macOS

1. Install sleepwatcher from brew

2. Create ~/.sleep file

#!/bin/zsh

echo $(blueutil -p) > ~/.bluestatus
bluestatus=$(head -n 1 ~/.bluestatus)
@mijorus
mijorus / skip_yt_ads.macro
Last active August 16, 2023 09:34
Skip Youtube ads Macro for Macrodroid - For all the languages
{
"disabledTimestamp": 0,
"forceEvenIfNotEnabledTimestamp": 0,
"isActionBlock": false,
"isBeingImported": false,
"isClonedInstance": false,
"isExtra": false,
"isFavourite": false,
"lastEditedTimestamp": 1692178071905,
"localVariables": [],
@mijorus
mijorus / flatpak-scripts.sh
Last active February 17, 2023 08:53
Flatpak builder scripts
# Run a flatpak
#! /usr/bin/bash
flatpak kill your.app.name
flatpak-builder build/ your.app.name.json --user --force-clean
flatpak-builder --run build/ your.app.name.json app-name
# Install a Flatpak
#! /usr/bin/bash
flatpak kill your.app.name
@mijorus
mijorus / mega-ftp-toggle.sh
Created December 5, 2022 12:36
Mega FTP toggle
# Toggle the ftp server on and off
test -f /tmp/megaftp-on && (mega-ftp -d --all && rm /tmp/megaftp-on && notify-send 'Mega FTP stopped') || (mega-ftp ./ && touch /tmp/megaftp-on && notify-send 'Mega FTP started'
@mijorus
mijorus / howto-swap-navigation-button-motorola.md
Created August 23, 2022 07:26
How to swap back and multitasking buttons on Motorola Phones, without external apps

For how crazy as it sounds, the setting is there but hidden.

Follow these steps:

  1. Add the settings widget to your home screen
  2. Select the 3 buttons navigation option (the label might be localized)
  3. Launch the shortcut