Skip to content

Instantly share code, notes, and snippets.

View peters's full-sized avatar
😀
On

Peter Rekdal Khan-Sunde peters

😀
On
View GitHub Profile
@peters
peters / pipewire.md
Created October 29, 2023 10:01 — forked from the-spyke/pipewire.md
Enable PipeWire on Ubuntu 22.04

Enable PipeWire on Ubuntu 22.04

This guide is only for original Ubuntu out-of-the-box packages. If you have added a custom PPA like pipewire-debian, you might get into conflicts.

Ubuntu 22.04 has PipeWire partially installed and enabled as it's used by browsers (WebRTC) for recoding the screeen under Wayland. We can enable remaining parts and use PipeWire for audio and Bluetooth instead of PulseAudio.

Starting from WirePlumber version 0.4.8 automatic Bluetooth profile switching (e.g. switching from A2DP to HSP/HFP when an application needs microphone access) is supported. Jammy (22.04) repos provide exactly version 0.4.8. So, we're good.

Based on Debian Wiki, but simplified for Ubuntu 22.04.

#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <sstream>
extern "C" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavformat/avio.h>
@peters
peters / ARMDebianUbuntu.md
Created September 22, 2020 19:46 — forked from bruce30262/ARMDebianUbuntu.md
Emulating ARM on Debian/Ubuntu

You might want to read this to get an introduction to armel vs armhf.

If the below is too much, you can try Ubuntu-ARMv7-Qemu but note it contains non-free blobs.

Running ARM programs under linux (without starting QEMU VM!)

First, cross-compile user programs with GCC-ARM toolchain. Then install qemu-arm-static so that you can run ARM executables directly on linux

If there's no qemu-arm-static in the package list, install qemu-user-static instead

@peters
peters / skiasharp_arm64.md
Created September 4, 2020 17:29 — forked from jclapis/skiasharp_arm64.md
Building SkiaSharp on a Raspberry Pi 4B

Recently, I've been playing around with a Raspberry Pi 4B that I just picked up. It's an awesome little device for the price; I'm really impressed with what it can do so far. I'm planning to use it as a driver for a DIY observatory I'm working on. As part of that, I'm writing an application that can remote control my camera and a custom motorized mount for my telescope. I decided to use .NET Core as my framework of choice; I'm a big fan of C# and its ecosystem, and the fact that .NET Core 3.1 works on ARM64 systems (which is what the Pi 4B runs) makes it a no-brainer.

Unfortunately, .NET Core doesn't come with any cross-platform UI frameworks out of the box. I use WPF a lot for Windows projects, but one of its biggest weaknesses is that it isn't supported on anything else. The WPF repo already has a very long thread about this very topic, so it's definitely one that's on a lot of peoples' minds. That be

Section "Monitor"
Identifier "Monitor0"
HorizSync 28.0-80.0
VertRefresh 48.0-75.0
# 1024x768 @ 60.00 Hz (GTF) hsync: 47.70 kHz; pclk: 64.11 MHz
# Modeline "1024x768_60.00" 64.11 1024 1080 1184 1344 768 769 772 795 -HSync +Vsync
# 1280x720 @ 60.00 Hz (GTF) hsync: 44.76 kHz; pclk: 74.48 MHz
# Modeline "1280x720_60.00" 74.48 1280 1336 1472 1664 720 721 724 746 -HSync +Vsync
# 1368x768 @ 60.00 Hz (GTF) hsync: 47.70 kHz; pclk: 85.86 MHz
# Modeline "1368x768_60.00" 85.86 1368 1440 1584 1800 768 769 772 795 -HSync +Vsync
# apt-get install
sudo apt-get update
# For ubuntu 14.04
sudo apt-get install -y xserver-xorg-video-dummy-lts-trusty
# For ubuntu 16.04
sudo apt-get install -y xserver-xorg-video-dummy-lts-willy
# Copy the xorg.conf to `/etc/X11/xorg.conf`.
wget -P /etc/X11 https://gist.githubusercontent.com/mangoliou/ba126832f2fb8f86cc5b956355346038/raw/b6ad063711226fdd6413189ad905943750d64fd8/xorg.conf
@peters
peters / answer.cs
Created June 21, 2018 14:12 — forked from jkingry/answer.cs
How do you close TCP connections gracefully without exceptions?
using System;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
namespace Example
{
class Channel
@peters
peters / DomainRoute.cs
Created October 22, 2017 00:43 — forked from IDisposable/DomainRoute.cs
Domain (hostname) Routing for Asp.Net MVC and WebAPI
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.Http;
using System.Web.Http.Routing;
using System.Web.Mvc;
@peters
peters / DomainRoute.cs
Created October 22, 2017 00:43 — forked from IDisposable/DomainRoute.cs
Domain (hostname) Routing for Asp.Net MVC and WebAPI
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.Http;
using System.Web.Http.Routing;
using System.Web.Mvc;
@peters
peters / mongodb_ssl_with_letsencrypt.md
Created February 1, 2017 07:46 — forked from leommoore/mongodb_ssl_with_letsencrypt.md
MongoDB 3.2.x SSL with Letsencrypt

#MongoDB 3.2.x SSL with Letsencrypt Letsencrypt is an initative which aims to increase the use of encryption for websites. It basically allows people to apply for free certificates provided that they prove the they control the requested domain. We will look at the what is needed to secure your MongoDB installation. For more details on setting up a MongoDB server see MongoDB 3.2.x.

##Set the hostname We sould to set the hostname to match the name of the certificate we are going to optain.

sudo hostname mongo0.example.com

Then update the hostname file to set the server name permanently.