Skip to content

Instantly share code, notes, and snippets.

View ozel's full-sized avatar
📻
most likely soldering or shifting bits

Oliver Keller ozel

📻
most likely soldering or shifting bits
View GitHub Profile
@cfangmeier
cfangmeier / keithley2410_SweepTest.py
Last active April 22, 2022 11:40
Creates an IV curve using Keithley 2410 Sweep Function
#!/usr/bin/env python3
import serial
import matplotlib.pyplot as plt
script = """
# hashes make comments
# @ on a read specifies the parser for the read data
*RST
:SENS:FUNC:CONC OFF #Turn off concurrent functions
@alexanderhupfer
alexanderhupfer / main.py
Last active November 15, 2019 10:50
Display logfile in realtime with bokeh
# Plot logtime in realtime using bokeh and tail -f
# Tested with python 3.5 and bokeh 0.12.4
# OSX/Linux only
# usage:
# 1. run 'bokeh serve'
# 2. run 'python3.5 main.py logfile.csv'
# assumes a logfile.csv with format:
# min_ask,1489758134.150000,1077.00,1076.78,0.45
# max_bid,1489758139.660000,1076.56,1076.76,0.41
# min_ask,1489758142.076000,1076.95,1076.76,0.40
@cr1901
cr1901 / clock_domains.md
Last active July 22, 2025 12:01
Migen Clock Domain Summary

Migen Clock Domains Summary

Terminology

  • Declaring a clock domain:
    • self.clock_domains.cd_mycd = ClockDomain()
  • Referencing a clock domain:
    • self.sync.mycd += []
    • ClockSignal("mycd")
  • Requesting an I/O signal:
  • platform.request("clk12")
@smunaut
smunaut / gtkwave-sigrok-filter.py
Last active June 1, 2025 11:10
Transaction Filter Process for GTKWave to run SigRok protocol decoders
#!/usr/bin/env python3
"""
gtkwave-sigrok-filter.py
Use as a 'Transaction Filter Process' in gtkwave to apply signal
Usage:
- Group input signals in gtkwave with F4
- Apply this script as a 'Transaction Filter Process' (Right click / Data Format)
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.pem with the following command:
# openssl req -new -x509 -keyout key.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
import http.server
@salotz
salotz / shimazaki_shinimoto_binning.py
Created January 9, 2020 18:16
Clean numpy-only implementation of the Shimazaki-Shinimoto histogram binning method as a function.
def shimazaki_shinimoto_binning(x, min_bins, max_bins):
"""The Shimazaki-Shinimoto histogram binning algorithm for choosing an
optimal constant number of bins.
Parameters
----------
x : array of int or float
The data you want to bin
@branw
branw / samd51_1dac_2adc_dma.cpp
Last active March 21, 2024 18:52
Minimum working example of analog data acquisition with one output and two inputs on the SAMD51 Grand Central M4.
// Produces a sawtooth on A0 and samples A1 and A3 into buffers via DMA
#include <Adafruit_ZeroDMA.h>
#include <wiring_private.h> // for access to pinPeripheral
// Create buffers for DMAing data around -- the .dmabuffers section is supposed to
// optimize the memory location for the DMA controller
__attribute__ ((section(".dmabuffers"), used)) static uint16_t dac_buffer[4096], adc_buffer[2][4096];
void setup() {
@newhouseb
newhouseb / delay_line.py
Created February 21, 2021 22:46
ECP5 Delay Line with ~50ps precision
# This is an nmigen delay line for ECP5 FPGAs using the open source toolchain. It strings together a series of
# manually placed carry chains into a "thermometer." It returns a signal that's (length) long that represents
# the chain "snapshotted" at the primary clock domain (using the flip flops colocated in the slice).
#
# This can be used in a Time to Digital Converter (i.e. to measure the time between to events) or in
# an ADC by comparing (with LVDS) a signal to a reference signal.
#
# Note that the bit precision (read: delay per carry element) varies as a function of temperature. On
# a LFE5U-25F-8MG285C, I've measure delay times of approximately 43ps on average. Due to assorted reasons,
# the delay time will vary between bits and due to variations in routing (even when manually places), you might
#
# This file is part of LiteX.
#
# Copyright (c) 2015-2019 Florent Kermarrec <[email protected]>
# Copyright (c) 2017 Pierre-Olivier Vauboin <po@lambdaconcept>
# Copyright (c) 2021 Jevin Sweval <[email protected]>
# SPDX-License-Identifier: BSD-2-Clause
from pathlib import Path
import os
@f1yn
f1yn / enable_gdm_synergy_not_a_script.md
Created November 14, 2022 05:36
Enable Synergy (correctly) at login on any Linux using GDM3

These commands come AS IS, WITH NO WARRANTY. I AM NOT RESPONSIBLE IF YOU BORK YOUR SYSTEM

Synergy on Linux - It's great when it works, but it's also a pain because most guides are intended for Ubuntu 18, which is absolutely useless now. Here is how I was able to setup Synergy at login on a Pop_OS 22.04, but should ALSO work for ANY distribution using GDM3 as it's login manager (i.e Fedora and/or Ubuntu).

Step 1

Install synergy. Make sure that synergyc is installed first (included in deb or rpm)

Step 2