Skip to content

Instantly share code, notes, and snippets.

View bodokaiser's full-sized avatar
😀
Happy to be here!

Bodo Kaiser bodokaiser

😀
Happy to be here!
View GitHub Profile
package main
import (
"log"
"net"
"net/http"
"os"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
@bodokaiser
bodokaiser / main.go
Created July 20, 2023 09:54
HTTP Server logging everything sent and received on the TCP socket.
package main
import (
"bufio"
"fmt"
"log"
"net"
"net/http"
)
@bodokaiser
bodokaiser / sri.py
Created July 6, 2023 08:36
Python class for the Stanford Research Instruments (SRI) PTC10 temperature (PID) controller
from telnetlib import Telnet
class PTC10:
def __init__(self, host: str, port=None):
self.host = host
self.port = port
def oven_power(self):
with Telnet(self.host, self.port) as conn:
@bodokaiser
bodokaiser / fused-silica-refractive-index.jl
Created June 28, 2023 07:29
Refractive indices for fused silica using the Sellmeier equation
### A Pluto.jl notebook ###
# v0.19.24
using Markdown
using InteractiveUtils
# ΓòöΓòÉΓòí ec26df3c-14b8-11ee-282f-c51a3afd5185
begin
using Unitful
using Statistics
@bodokaiser
bodokaiser / README.md
Last active June 19, 2023 09:06
Stanford Research Instruments PTC10

Stanford Research Instruments PTC10

Usage

go run main.go > time_date.csv

Show help for optional arguments:

@bodokaiser
bodokaiser / picolog.py
Created June 6, 2023 15:26
Python class wrapping the picosdk interface for the Pico Logger USB TC-08
import ctypes
import numpy as np
import numpy.typing as npt
from picosdk.usbtc08 import usbtc08 as tc08
from picosdk.functions import assert_pico2000_ok
MAX_CHANNELS = 8
@bodokaiser
bodokaiser / Dockerfile
Created June 2, 2023 08:07
Dockerfile for installing numpy, scipy, and numba from requirements.txt
FROM python:3.9-slim
RUN apt update && apt install --assume-yes --no-install-recommends \
build-essential
WORKDIR /tmp
COPY requirements.txt ./
RUN pip install --no-cache -r requirements.txt
from abc import ABC, abstractmethod
from argparse import ArgumentParser, BooleanOptionalAction
import numpy as np
from matplotlib import pyplot as plt
from scipy import linalg
pauli_z = np.array([[1, 0], [0, -1]], dtype=complex)
pauli_x = np.array([[1, 0], [0, -1]], dtype=complex)

How to flash the STM32 "blue pill" on macOS Mojave (arm64)

Valid as of March 27th 2022

OpenOCD debugger

Install the latest openocd version (the official version produces a [segmentation fault][1])

brew install openocd --head
<!DOCTYPE html>
<html>
<head>
<title>iFrame Proxy</title>
</head>
<body>
<iframe src="http://localhost:3000?domain=google.com" width="800" height="400"></iframe>
<script>
const domain = (new URL(document.location)).searchParams.get('domain')