Skip to content

Instantly share code, notes, and snippets.

View pulsar256's full-sized avatar

Paul Rogalinski-Pinter pulsar256

  • 4.screen
  • Munich
  • 08:56 (UTC +02:00)
View GitHub Profile
@pulsar256
pulsar256 / opus-p2p-streaming.md
Last active January 29, 2024 01:19
Opus p2p Audio Streaming

Opus p2p streaming

Low latency streaming of ogg compressed audio data between two peers using RTP and gstreamer-1.0. Expected latency over the network is below 1 second.

Producer

The producer will provide a Jack sink which needs to be connected to a audio producer.

TARGET_PORT=5100
@pulsar256
pulsar256 / ssd1306_init.c
Last active December 5, 2023 20:27
SSD 1306 Init Sequence
/**
* according to http://www.adafruit.com/datasheets/UG-2864HSWEG01.pdf Chapter 4.4 Page 15
*/
void ssd1306Init(void)
{
i2c_OLED_send_cmd(0xAE); // Set display OFF
i2c_OLED_send_cmd(0xD4); // Set Display Clock Divide Ratio / OSC Frequency
i2c_OLED_send_cmd(0x80); // Display Clock Divide Ratio / OSC Frequency
@pulsar256
pulsar256 / my_hetzner_xen_setup.md
Last active February 9, 2023 22:20
Hetzner Xen + v4 Subnet + v6 Subnet Setup HowTo

Hetzner Primary IPv4 IP + IPv4/2x Subnet + "Non-Routed" IPv6/64 Subnet HowTo

... so I do not forget the next time I have to figure this stuff out. And perhaps to help other poor souls fiddling with v6/v4 xen setups in a Hetzner network environment.

Basic setup

You can basically follow along the Xen Project Beginners Guide.

The short version

Install Debian Wheezy via Hetzner's installimage on the rescue system, the only important part about partitioning is that you have an LVM volume group named vg0 with enough space for your guests' disks.

@pulsar256
pulsar256 / dynv6_v4only.sh
Last active January 11, 2022 09:58 — forked from corny/dynv6.sh
Update script for dynv6.com to set your IPv4 address
#!/bin/sh -e
# based on https://gist.github.com/corny/7a07f5ac901844bd20c9
hostname=$1
device=$2
v4_file=$HOME/.${hostname}.dynv6.addr4
[ -e $v4_file ] && old=`cat $v4_file`
@pulsar256
pulsar256 / flash_skr1.3.sh
Created May 28, 2021 20:54
Flash klipper on a SKR1.3 wired direclty via serial to the RPI
#!/bin/bash
pin_reset=22
pin_boot=26
firmware=$HOME/klipper/out/klipper.bin
sudo systemctl stop klipper
# enter boot bootloader sequence
gpio mode $pin_reset OUT
import 'dart:async';
import 'dart:io';
import 'dart:math';
StreamController<int> controller = StreamController();
Future<void> main() async {
final paths = [for (var i = 0; i < 100; i++) "path $i"];
@pulsar256
pulsar256 / throttled_iterator.dart
Created October 7, 2020 08:53
throttled_iterator.dart
extension on Iterator {
void throttledForEach(int parallelFutures, ForEachCallback onData,
[ItemProcessedCallback onProgress]) async {
final semaphores = StreamController<int>();
while (parallelFutures-- > 0) {
semaphores.add(1);
}
await for (var _ in semaphores.stream) {
if (!moveNext()) break;
var f = onData(current)
[stepper_x]
step_pin: P2.2
dir_pin: !P2.6
enable_pin: !P2.1
step_distance: .0125
endstop_pin: !P1.29 # P1.28 for X-max
position_endstop: 0
position_max: 320
homing_speed: 50
#!/bin/bash
# Flashes a LPC based boards over the serial line connected to the GPIO headers of a RPI.
# In addition to the TX/RX lines you will also need to connect the BOOT and RESET lines.
# This configuration uses GPIO6 for RESET and GPIO12 for BOOT. Pin numbering is using
# the wiring standard.
pin_reset=22
pin_boot=26
firmware=$HOME/klipper/out/klipper.bin
@pulsar256
pulsar256 / pageTokenGen.js
Created May 21, 2015 17:17
Generator for pageTokens for the Youtube API
// workaround for https://code.google.com/p/gdata-issues/issues/detail?id=7163
var d0 = "AEIMQUYcgkosw048";
var d1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
var d2 = d1;
var d1c = 0;
var d2c = 0;
var overflowSuffix = "Q";
var direction = "AA";
var d2OverflowCounter = 0;