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
# 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 / FluentAggregationExtensions.md
Last active October 2, 2017 15:58
A collection of fluent aggregation extension methods that should find it's way into the official MongoDB c# driver

Spec

public static class FluentAggregationExtensions 
{

  public static Task<List<TNewResult>> ProjectToListAsync<TResult, TNewResult>(this IAggregateFluent<TResult> aggregate, Expression<Func<TResult, IEnumerable<TNewResult>>> field)
  {
    var fieldName = $"${((MemberExpression) field.Body).Member.Name}";
@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 / gist:4911498c57826d7052a32d874a62e6e2
Created October 31, 2016 19:03
1N5fwe9QCuxJM7y1ThagJiBz11KvKysvZv
1N5fwe9QCuxJM7y1ThagJiBz11KvKysvZv
@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) {
diff --git a/src/openalpr/support/timing.cpp b/src/openalpr/support/timing.cpp
index 82c8374..d0a8055 100644
--- a/src/openalpr/support/timing.cpp
+++ b/src/openalpr/support/timing.cpp
@@ -67,7 +67,7 @@ namespace alpr
microseconds = (double)t.QuadPart / frequencyToMicroseconds;
t.QuadPart = microseconds;
tv->tv_sec = t.QuadPart / 1000000;
- tv->tv_usec = t.QuadPart % 1000000;
+ tv->tv_nsec = t.QuadPart % 1000000;
diff --git a/src/openalpr/postprocess/regexrule.cpp b/src/openalpr/postprocess/regexrule.cpp
index c4bf857..be2871f 100644
--- a/src/openalpr/postprocess/regexrule.cpp
+++ b/src/openalpr/postprocess/regexrule.cpp
@@ -75,11 +75,11 @@ namespace alpr
}
else if (utf_character == "@")
{
- this->regex = this->regex + "\\p{Alpha}";
+ this->regex = this->regex + "\p{Alpha}";