Skip to content

Instantly share code, notes, and snippets.

View jaybo's full-sized avatar

Jay Borseth jaybo

View GitHub Profile
@jaybo
jaybo / NewtonsoftJsonSnakeCaseFormatterAttribute.cs
Created May 6, 2022 04:45
Allow single dotnetcore controller to use snake case Newtonsoft.json while the rest of the webapp uses System.Text.Json
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ApplicationModels;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.Formatters;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ModelBinding.Binders;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.ObjectPool;
@jaybo
jaybo / gist:3c2cbe65e1372f0fb58c7c197c29cfa7
Created February 15, 2021 09:49
Extract Sender ID from Email Headers
import imaplib
import re
gmail = False
if gmail:
mail = imaplib.IMAP4_SSL('imap.gmail.com')
mail.login('user', 'password')
mail.select('"[Gmail]/All Mail"')
else:
mail = imaplib.IMAP4_SSL('outlook.office365.com')
@jaybo
jaybo / index.html
Last active February 10, 2021 23:55 — forked from danswick/index.html
Demonstrate laggy behavior in Mapbox Draw
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<script src="https://api.mapbox.com/mapbox-gl-js/v2.1.1/mapbox-gl.js"></script>
<link href="https://api.mapbox.com/mapbox-gl-js/v2.1.1/mapbox-gl.css" rel="stylesheet" />
<style>
@jaybo
jaybo / gist:4b29dde114d501da23742c021c3e44af
Last active May 21, 2020 20:38
Microsoft Terminal setup
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{0caa0dad-35be-5f56-a8ff-afceeeaa6103}",
"profiles":
{
@jaybo
jaybo / TestMatchThreads.cpp
Last active September 29, 2022 04:55
Multithreading template matching OpenCV
#include <opencv2/opencv.hpp>
#include <chrono>
using namespace std;
typedef std::chrono::high_resolution_clock Clock;
void threadCallback(GpuMat &imS, GpuMat &imT, int count)
{
std::cout << "Start Thread = " << std::this_thread::get_id() << std::endl;
GpuMat imR = GpuMat(imS.size().height - imT.size().height + 1,
@jaybo
jaybo / SematicSeg.txt
Last active July 19, 2018 00:27
Semantic Segmentation Notes
Background:
http://cs231n.github.io/convolutional-networks/#convert
Converting classification net to sematic:
https://blog.goodaudience.com/using-convolutional-neural-networks-for-image-segmentation-a-quick-intro-75bd68779225
Environnment:
conda create --name tf pip
let colormap = require('colormap')
var fs = require('fs');
let map_name = 'bluered';
let file_name = map_name + ".json"
let colors = colormap({
colormap: map_name,
nshades: 100,
format: 'hex',
@jaybo
jaybo / settings.json
Created April 15, 2017 22:34
VSCode settings.json
// Place your settings in this file to overwrite the default settings
{
"python.pythonPath": "C:/WinPython/WinPython-64bit-2.7.10.3/python-2.7.10.amd64/python.exe",
"typescript.check.tscVersion": false,
"workbench.colorTheme": "Visual Studio Dark",
"editor.minimap.enabled": true,
"python.linting.pylintArgs": [
"--disable=C0301", // Line too long
"--disable=C0103", // Invalid function name"
"--disable=C0303", // Trailing whitespace
@jaybo
jaybo / 2DBoundary.py
Last active August 11, 2016 03:53
2D boundary interpolation in numpy
import numpy as np
import matplotlib.pyplot as plt
from scipy.interpolate import interp1d
x = [0, 1, 1, 0, 0]
y = [0, 0, 1, 1, 0]
orig_len = len(x)
t = np.arange(len(x))
opencv_calib3d300d.lib; opencv_core300d.lib ;opencv_features2d300d.lib; opencv_flann300d.lib; opencv_hal300d.lib; opencv_highgui300d.lib; opencv_imgcodecs300d.lib; opencv_imgproc300d.lib; opencv_ml300d.lib; opencv_objdetect300d.lib; opencv_photo300d.lib; opencv_shape300d.lib; opencv_stitching300d.lib; opencv_superres300d.lib; opencv_ts300d.lib; opencv_video300d.lib; opencv_videoio300d.lib; opencv_videostab300d.lib;