Skip to content

Instantly share code, notes, and snippets.

View prydin's full-sized avatar

Pontus Rydin prydin

View GitHub Profile
@prydin
prydin / dac.v
Created April 15, 2024 00:57
Delta/sigma-DAC
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 03/09/2024 02:08:14 PM
// Design Name:
// Module Name: dac
// Project Name:
// Target Devices:
@prydin
prydin / am.m
Created April 1, 2024 23:46
AM Detection example
# Generate test signal
t = linspace(0,120*pi, 1000)
baseband = cos(t/40)
carrier = cos(t)
modulated = carrier .* baseband
# Downshift and split into I and Q
fq_offset = 1.05 # Carrier and LO are off by 5%
i = cos(t*fq_offset) .* modulated
q = sin(t*fq_offset) .* modulated
@prydin
prydin / radio.py
Created February 15, 2024 23:39
AM demodulation pipeline
# Baseband sample rate
import math
import matplotlib.pyplot as plt
import numpy
from scipy import signal, fft
import numpy as np
# RF sampling rate
rf_rate = 6e6
@prydin
prydin / dds.v
Last active November 15, 2023 14:56
DDS attempt
module dds
#(parameter ACC_LENGTH = 48,
parameter PHASE_LENGTH = 14
) (
input sys_clk,
input spi_clk,
input spi_data,
input freq_cs,
input phaseshift_cs,
input [1:0] mode_in,
@prydin
prydin / vrohelper.py
Created June 14, 2023 19:00
Simplified vRO API
from functools import lru_cache
import requests
import time
class AutomationClient:
"""
Low level Aria Automation/Orchestration client.
"""
@prydin
prydin / FeatureDetector.java
Created January 29, 2022 15:21
Minecraft 1.18.1 tree detector
package nu.rydin.enchante.utils;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.Property;
import javax.annotation.Nullable;
import java.util.Collection;
@prydin
prydin / prevent_powerdown.py
Last active January 6, 2022 15:16
Prevent power down on change
import json
def handler(context, inputs):
# We only care about updates
if inputs["eventType"] != "UPDATE_DEPLOYMENT":
return inputs
result = context.request("/blueprint/api/blueprint-requests/%s/resources-plan?expand=true" % inputs["id"], "GET", "")
if result["status"] != 200:
raise Exception(result["content"])
envelope = json.loads(result["content"])
@prydin
prydin / gist:0ce7afd7b5ee36af845ccad8555c4d87
Created December 15, 2021 20:59
Enable ABX custom resources
import json
def handler(context, inputs):
payload = {
"key": "enable.custom.resource.user-defined-schema",
"value": "true"
}
print(context.request("/provisioning/config/toggles", "POST", json.dumps(payload)))
@prydin
prydin / metrics.json
Created March 26, 2021 00:01
Sample VM metric dump
{
"resources": [
{
"metrics": [
{
"name": "virtualDisk:scsi0:1|totalReadLatency_average",
"samples": [
{
"t": 1616713319999,
"v": 0.7333333492279053
@prydin
prydin / mvn.log
Created September 30, 2020 12:22
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for io.jenkins.plugins:vrealize-automation-8:hpi:1.1-SNAPSHOT
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.jenkinsci.plugins:pipeline-model-definition:jar -> duplicate declaration of version ${pipeline-model-definition-plugin.version} @ line 154, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]