Skip to content

Instantly share code, notes, and snippets.

@rcarmo
rcarmo / .tmux.conf
Last active April 17, 2021 23:01
Raspberry Pi tmux status bar
set-option -g status-right "#(/home/pi/status.sh) %H:%M %d-%b-%y"
@rcarmo
rcarmo / run.csx
Created July 2, 2019 10:08
Simple C# Function to query Azure SQL DB and return JSON reply
#r "Newtonsoft.Json"
using System.Text;
using System.Net;
using System.Linq;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;
using System.Collections.Generic;
using System.Collections;
@rcarmo
rcarmo / bt-agent.service
Last active December 3, 2025 03:58
Set up PAN networking on Raspbian Stretch (use sudo to create these files and run all commands)
# in /etc/systemd/system
[Unit]
Description=Bluetooth Agent
[Service]
ExecStart=/usr/bin/bt-agent -c NoInputNoOutput
Type=simple
[Install]
WantedBy=multi-user.target
@rcarmo
rcarmo / build_qemu_debian_image.sh
Created June 19, 2019 14:02 — forked from sigmaris/build_qemu_debian_image.sh
Automate the installation of Debian Buster on a x86_64 QEMU 4.0.0 VM hosted on macOS
#!/bin/bash -e
if [ "$(uname -s)" != "Darwin" ]
then
echo "This script is for building a Debian x86_64 image to use on MacOS"
exit 1
fi
TEMP="$(mktemp -d build.XXXXX)"
cp preseed.cfg $TEMP
@rcarmo
rcarmo / gist:cbd315bf4b058c23b65505d4c0a7c99c
Created April 20, 2019 15:59 — forked from nosuchuser/gist:21db3fdd9f4b80bf0910f8b8b6ea2f63
dnsmasq.conf configuration for vodafone IPTV
server=/.iptvpoc.alu/.discovery.iptv.microsoft.com/.iptv.vodafone.pt/.iptvdiscovery/.ims.vodafone.pt/192.168.1.1
@rcarmo
rcarmo / Makefile
Created December 25, 2018 16:38
Backup HomeKit data
export [email protected]:~/.config/
export TARGET?=home.lan
export TAG_DATE=`date -u +"%Y%m%d"`
.PHONY: snapshot init
init:
mkdir -p $(TARGET)
git init
#!/bin/bash
# instant-rsyncd lets you quickly set up and start a simple, unprivileged rsync
# daemon with a single module in the current directory. I've found it
# invaluable for quick testing, and I use it when writing a list of commands
# that people can paste into a terminal to reproduce a daemon-related bug.
# Sysadmins deploying an rsync daemon for the first time may find it helpful as
# a starting point.
#
# Usage: instant-rsyncd MODULE PORT RSYNCD-USERNAME [RSYNC-PATH]
@rcarmo
rcarmo / ssdp.py
Last active September 24, 2018 12:49
Quick and dirty SSDP/UPNP/Mediaroom discovery
from http.client import HTTPResponse
from io import BytesIO
from config import log
from struct import pack
from socket import AF_INET, SOCK_DGRAM, INADDR_ANY, IPPROTO_IP, IPPROTO_UDP, IP_ADD_MEMBERSHIP, IP_MULTICAST_TTL, SOL_SOCKET, SO_REUSEADDR, SO_REUSEPORT, getaddrinfo, socket, setdefaulttimeout, inet_pton, timeout as SocketTimeout
from utils import etree_to_dict
from xml.etree import ElementTree
from time import time
from dateutil.parser import parse as parse_date
@rcarmo
rcarmo / azds-osx-setup.sh
Last active August 8, 2018 16:23
Set up Azure Dev Spaces on Mac without sudo
#!/bin/bash
info() { echo "[INFO] $*" ; }
fatal() { echo "[FATAL] $*" ; exit 1 ; }
AZDS_SRC="https://azuredevspacestools.blob.core.windows.net/azdssetup"
AZDS_ZIP=AzdsCliMacOSX.zip
AZDS_LIB="$HOME/Library/Azure/lib/azds-cli"
AZDS_BIN="$HOME/Library/Azure/bin/azds"
KUBECTL_PATH="$AZDS_LIB/kubectl/osx/kubectl"
@rcarmo
rcarmo / pronto2broadlink.py
Last active April 12, 2018 02:10 — forked from appden/pronto2broadlink.py
Convert Pronto IR hex codes to LIRC pulses then Broadlink packets compatible with python-broadlink