Last active
January 28, 2024 08:26
-
-
Save dushankw/46f7adeaa9e4d16a3882f940b49f85e1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/udev/rules.d/NN-rtl-sdr.rules | |
# sudo udevadm control --reload-rules && sudo udevadm trigger | |
# sudo usermod -a -G plugdev $USER | |
SUBSYSTEM=="usb", ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="2838", MODE="0660", GROUP="plugdev" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys | |
def convert_frequency(freq, unit): | |
# Convert frequency to MHz | |
if unit.lower() == "khz": | |
freq_mhz = freq / 1000 | |
elif unit.lower() == "mhz": | |
freq_mhz = freq | |
elif unit.lower() == "ghz": | |
freq_mhz = freq * 1000 | |
else: | |
raise ValueError("Unsupported unit. Please use kHz, MHz, or GHz.") | |
# Up-convert by 125 MHz | |
freq_mhz += 125 | |
return freq_mhz | |
if __name__ == "__main__": | |
if len(sys.argv) != 3: | |
print(f"Usage: python3 {sys.argv[0]} <frequency> <unit>") | |
sys.exit(1) | |
try: | |
frequency = float(sys.argv[1]) | |
unit = sys.argv[2] | |
result = convert_frequency(frequency, unit) | |
print(f"Up-converted frequency: {result} MHz") | |
except ValueError as e: | |
print(e) | |
sys.exit(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment