Skip to content

Instantly share code, notes, and snippets.

@rxseger
rxseger / rtl_rpcd
Created July 4, 2016 03:21
Startup script /etc/init.d/rtl_rpcd for running rtl_rpcd + IR
#!/bin/sh
### BEGIN INIT INFO
# Provides: rtl_rpcd
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: rtl_rpcd RTL-SDR RPC daemon
# Description: Receives RF and IR messages from a RTLSDR dongle
### END INIT INFO
@rxseger
rxseger / nec-pwr.py
Last active April 8, 2024 16:20
Script using RTL-SDR with IR to power off system when RTL remote power button pressed
#!/usr/bin/python
# Quick & dirty script to power down the computer when receiving
# a "power button" IR signal from the RTL remote over RTL-SDR dongle
# via rpc_ir librtlsdr: https://github.com/rxseger/librtlsdr/pull/1
# Intended for use with Raspberry Pi, which lacks a built-in power button
# Usage:
# rtl_rpcd -I 1235
@rxseger
rxseger / nec-pwr
Created July 4, 2016 03:24
Startup script /etc/init.d/nec-pwr for use with nec-pwr.py
#!/bin/sh
### BEGIN INIT INFO
# Provides: nec-pwr
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: NEC IR power-off daemon
# Description: Receives IR messages from a RTLSDR dongle
# and shuts down when the remote power button is pressd
@rxseger
rxseger / gist:2c0aea05f47e162725f5ec703461d32a
Created July 4, 2016 23:07
inspectrum compile error against liquid-dsp 1.2.0
brew tap dholm/sdr
brew install dholm/sdr/liquid-dsp
# problem: installs liquid-dsp 1.2.0, released Apr 26, 2012,
# FIX: brew install --HEAD dholm/sdr/liquid-dsp
git clone https://github.com/miek/inspectrum
# https://github.com/miek/inspectrum/tree/fc9e575052a069923a21b496f73f2b4867539a2f
cd inspectrum
cmake .
make
@rxseger
rxseger / gptest.py
Created July 11, 2016 05:25
Raspberry Pi 3 GPIO testing pushbutton input and LED output
#!/usr/bin/python
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
BTN_G = 11 # G17
BTN_R = 12 # G18
BTN_Y = 13 # G27
@rxseger
rxseger / flightled
Last active July 13, 2016 02:36
/etc/init.d/flightled startup script for flightled.py
#!/bin/sh
#### MOVED TO https://github.com/rxseger/flightled
### BEGIN INIT INFO
# Provides: flightled
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Light up LEDs when a watched flight is observed
@rxseger
rxseger / flightled.py
Last active July 13, 2016 02:36
flightled.py - light up LEDs using GPIO in response to dump1090 flights
#!/usr/bin/python
# Light up LEDs using GPIO in response to dump1090 flights
### MOVED TO https://github.com/rxseger/flightled
import socket
import select
import time
import datetime
import os
import RPi.GPIO as GPIO
@rxseger
rxseger / crypt.c
Created August 14, 2016 06:02
crypt(3) command-line wrapper, compile with: cc crypt.c -o crypt -lcrypt
#include <stdio.h>
#include <crypt.h>
int main(int argc, char **argv) {
if (argc < 3) {
fprintf(stderr, "usage: %s key salt\n", argv[0]);
return -1;
}
char *result = crypt(argv[1], argv[2]);
if (!result)
@rxseger
rxseger / gpint.py
Created August 21, 2016 19:03
interrupt-driven GPIO example using LEDs and pushbuttons for Raspberry Pi 3
#!/usr/bin/python
# interrupt-based GPIO example using LEDs and pushbuttons
import RPi.GPIO as GPIO
import time
import threading
GPIO.setmode(GPIO.BOARD)
@rxseger
rxseger / gpint
Created August 21, 2016 19:04
/etc/init.d/gpint daemon script for gpint.py https://gist.github.com/rxseger/cb10cb02b27f32b7a0003d03afb35db7
#!/bin/sh
### BEGIN INIT INFO
# Provides: gpint
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Interrupt-based GPIO LED/pushbutton daemon
# Description: Listens for button events and lights up LEDs
### END INIT INFO