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 / jquery-bootstrap-browserify.js
Created September 3, 2016 13:21 — forked from MiguelCastillo/jquery-bootstrap-browserify.js
Adding require jquery to bootstrap via a browserify transform
var browserify = require('browserify');
var gulp = require('gulp');
var source = require('vinyl-source-stream');
var through = require('through');
var libs = ['jquery', 'bootstrap'];
gulp.task('app-bundle', function() {
var appBundler = browserify(['./app.js']);
libs.forEach(function(lib) {
@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.

@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 / 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
# 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
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
@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

@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

#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>