Skip to content

Instantly share code, notes, and snippets.

Avatar

Jared Rhodes QiMata

View GitHub Profile
@QiMata
QiMata / Channel.cs
Created Jun 26, 2020
Creating a new guid using the channel info
View Channel.cs
enum Channel : byte
{
UnknownChannel = 0,
Email = 1,
CallCenter = 2,
BrokerHelpDesk = 3,
BrokerPortal = 4
}
@QiMata
QiMata / create_trigger.sql
Created Jun 18, 2020
A function for creating the trigger
View create_trigger.sql
CREATE TRIGGER address_versioning_trigger
BEFORE UPDATE OR DELETE ON location.address
FOR EACH ROW EXECUTE PROCEDURE address_trigger_function();
@QiMata
QiMata / address_trigger_function.sql
Created Jun 18, 2020
Trigger for insert into logging table
View address_trigger_function.sql
create function address_trigger_function()
returns trigger as $$
BEGIN
insert into logging_address_address (address_id, type, street1, street2, street3, street4, city, po_box_code, phone_number, date_created, operation)
values (old.address_id, old.type, old.street1,old.street2,old.street3,old.street4,old.city,old.po_box_code,old.phone_number, old.date_created,TG_OP);
RETURN NEW;
end;
$$ LANGUAGE plpgsql;
@QiMata
QiMata / logging_address.sql
Created Jun 18, 2020
Logging table for table to be logged
View logging_address.sql
create table logging_address
(
like address EXCLUDING CONSTRAINTS,
operation char(10) not null,
date_operated timestamp with time zone not null default current_timestamp
);
@QiMata
QiMata / address_table.sql
Created Jun 18, 2020
Table to be logged
View address_table.sql
create table address
(
address_id integer not null,
type varchar(100),
street1 varchar(120) not null,
street2 varchar(120),
street3 varchar(120),
street4 varchar(120),
city varchar(80),
po_box_code varchar(20) not null,
@QiMata
QiMata / ClassGenerator.cs
Created Nov 12, 2019
Showcasing how to generate proto files dynamically using protobuf-net
View ClassGenerator.cs
public class ClassGenerator
{
private readonly ModuleBuilder _moduleBuilder;
public ClassGenerator()
{
var an = new AssemblyName("DynamicProtoAssembly");
AssemblyBuilder assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(an,AssemblyBuilderAccess.Run);
_moduleBuilder = assemblyBuilder.DefineDynamicModule("DynamicProtoModule");
@QiMata
QiMata / CustomVisionImageProcessor.py
Created Jun 20, 2019
Image processor for creating images that can be classified by a custom vision model
View CustomVisionImageProcessor.py
from PIL import Image
import numpy as np
import cv2
def convert_to_opencv(image):
# RGB -> BGR conversion is performed as well.
image = image.convert('RGB')
r,g,b = np.array(image).T
opencv_image = np.array([b,g,r]).transpose()
return opencv_image
@QiMata
QiMata / CustomVisionCategorizer.py
Created Jun 20, 2019
A python script that loads a tensorflow model into memory without holding the global tensor flow graph hostage
View CustomVisionCategorizer.py
import tensorflow as tf
import numpy as np
# The category name and probability percentage
class CategoryScore:
def __init__(self, category, probability: float):
self.category = category
self.probability = probability
@QiMata
QiMata / ISharedMemoryConsumer.cs
Created Jun 10, 2019
The C# portions of the shared memory provider
View ISharedMemoryConsumer.cs
using System;
public delegate void HandleMessage(byte[] message);
internal delegate void InternalHandleMessage(IntPtr array, int length);
public interface ISharedMemoryConsumer
{
long Size();
void SetCallback(HandleMessage handler);
@QiMata
QiMata / NetCoreModule.cpp
Created May 20, 2019
The .NET portion of the shared memory provider
View NetCoreModule.cpp
extern "C" ImageNetCoreSharedMemoryConsumer* GetImageConsumer(char * name)
{
return new ImageNetCoreSharedMemoryConsumer(std::string(name));
}
extern "C" void DeleteImageNetCoreSharedMemoryConsumer(ImageNetCoreSharedMemoryConsumer* consumer)
{
delete consumer;
}
You can’t perform that action at this time.