Skip to content

Instantly share code, notes, and snippets.

View AlexFWulff's full-sized avatar

Alex Wulff AlexFWulff

View GitHub Profile
import SoapySDR
from SoapySDR import *
import numpy as np
fsamp = 8e6
fcenter = 107.9e6
nsamp = 2**20
# Apparently it takes AGC a while to settle in?
throwaway_time = 0.02
@AlexFWulff
AlexFWulff / PlutoRX.py
Created July 30, 2021 15:04
SoapySDR PlutoSDR Python Receive
import SoapySDR
from SoapySDR import *
import numpy
import time
args = dict(driver="plutosdr", hostname="192.168.2.1")
sdr = SoapySDR.Device(args)
# Setup device
sdr.setSampleRate(SOAPY_SDR_RX, 0, 10e6)
@AlexFWulff
AlexFWulff / hackrf_loop.c
Created July 12, 2021 15:07
Loosely based on hackrf_read.c (https://gist.github.com/beurtschipper/a8c0b472392da212bf03b08f372a8f7d). This code creates a fault state in the most recent HackRF release.
// HackRF lib
#include <hackrf.h>
// Normal system libs
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <unistd.h>
#include <signal.h>
// Device object
import numpy as np
from os import environ
environ["KERAS_BACKEND"] = "plaidml.keras.backend"
import keras
from keras.layers import Dense
from matplotlib import pyplot as plt
# Params
num_samples = 100000; vect_len = 20; max_int = 10; min_int = 1;
if ~exist('port','var')
ports = serialportlist;
port = serialport(ports(end),115200);
end
configureTerminator(port,"CR");
x = input('Sample Name to Write: \n','s');
count = 1; sample_len = 500; plotWinSize = 100;
data = NaN(1,sample_len); plot(data)
n02099601-golden_retriever | 0.88617605
n02104029-kuvasz | 0.027797867
n02099267-flat-coated_retriever | 0.02071613
n02100735-English_setter | 0.011913459
n02102318-cocker_spaniel | 0.010424928
n02102177-Welsh_springer_spaniel | 0.0103628095
...
let model = try? VNCoreMLModel(for: DogNet().model)
let request = VNCoreMLRequest(model: model!) { (request, error) in
let results = request.results as! [VNClassificationObservation]
for result in results {
print("\(result.identifier) | \(result.confidence)")
}
}
let handler = VNImageRequestHandler.init(cgImage: UIImage(named: "Chelsea.JPG")!.cgImage!, options: [:])
try? handler.perform([request])
+------------------+--------------+------------------+
| Images Processed | Elapsed Time | Percent Complete |
+------------------+--------------+------------------+
| 1 | 8.62s | 0% |
| 2 | 8.69s | 0% |
| 3 | 8.76s | 0% |
| 4 | 8.82s | 0% |
... ... ...
| 20400 | 21m 49s | 99% |
| 20450 | 21m 52s | 99.25% |
import CreateMLUI
let builder = MLImageClassifierBuilder()
builder.showInLiveView()