Skip to content

Instantly share code, notes, and snippets.

View Laeeth's full-sized avatar

Laeeth Isharc Laeeth

View GitHub Profile
@Laeeth
Laeeth / libzfs.d
Last active October 3, 2017 10:02
First steps towards creating dlang binding for libzfs
module kaleidic.api.libzfs;
/**
LibZFS - ported to the D programming language by Jonathan Davis and Laeeth Isharc
(c) Kaleidic Associates 2017
License - CDDL
*/
/**
@Laeeth
Laeeth / makewhitelist.d
Created June 26, 2017 19:48
Make postgrey/spamassassin whitelist
#!/usr/bin/dmd
import std.stdio;
import std.string;
import std.process;
import std.algorithm;
import std.array:array;
import std.typecons:Tuple;
import std.file:exists;
enum whitelists=[ "/etc/mail/spamassassin/sent_whitelist.txt",
@Laeeth
Laeeth / netfw.d
Created June 19, 2017 20:11
netfw.d
// File generated by idl2d from
// C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include\netfw.idl
module sdk.win32.c:.program files (x86).microsoft sdks.windows.v7.1a.include.netfw;
import sdk.port.base;
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) Microsoft Corporation.
@Laeeth
Laeeth / makeall_pigeonhole.sh
Created December 28, 2016 20:34
(re) build script for dovecot pigeonhole
./configure --prefix=/usr \
--with-dovecot=/opt/dovecot_git/core \
--with-moduledir=/opt/dovecot_git/modules \
--disable-static
make
@Laeeth
Laeeth / makeall_dovecot.sh
Created December 28, 2016 20:33
(re) build script for dovecot core
./configure --prefix=/usr --sysconfdir=/etc \
--sbindir=/usr/bin \
--localstatedir=/var \
--libexecdir=/usr/lib \
--with-moduledir=/usr/lib/dovecot/modules \
--with-systemdsystemunitdir=/usr/lib/systemd/system \
--disable-static \
--with-nss \
--with-pam \
--with-mysql \
@Laeeth
Laeeth / mail-namespace.c
Created December 28, 2016 20:19
fixes for dovecot
// src/lib/storage/mail-namespace.c
// for dovecot core
/* Copyright (c) 2005-2016 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "str.h"
#include "file-lock.h"
#include "settings-parser.h"
#include "mailbox-list-private.h"
@Laeeth
Laeeth / README.md
Created March 25, 2016 13:44 — forked from dannguyen/README.md
Using Google Cloud Vision API to OCR scanned documents to extract structured data

Using Google Cloud Vision API's OCR to extract text from photos and scanned documents

Just a quickie test in Python 3 (using Requests) to see if Google Cloud Vision can be used to effectively OCR a scanned data table and preserve its structure, in the way that products such as ABBYY FineReader can OCR an image and provide Excel-ready output.

The short answer: No. While Cloud Vision provides bounding polygon coordinates in its output, it doesn't provide it at the word or region level, which would be needed to then calculate the data delimiters.

On the other hand, the OCR quality is pretty good, if you just need to identify text anywhere in an image, without regards to its physical coordinates. I've included two examples:

####### 1. A low-resolution photo of road signs

module kaleidic.api.tika;
import std.stdio;
import core.thread;
import std.algorithm;
import std.array;
import std.conv;
import std.exception;
import std.string;
import std.file;
import vibe.d;
@Laeeth
Laeeth / pipedprocess.d
Created December 3, 2015 18:25 — forked from s-ludwig/pipedprocess.d
Vibe.d compatible process wrapper class.
class PipedProcess {
import stdfilestream;
private {
ProcessPipes m_pipes;
StdFileStream m_stdout;
StdFileStream m_stdin;
Thread m_waitThread;
SysTime m_startTime;
SysTime m_endTime;
@Laeeth
Laeeth / stdfilestream.d
Created December 3, 2015 18:23 — forked from s-ludwig/stdfilestream.d
Wrapper class to make an existing `File` stream usable in a vibe.d event loop.
// NOTE: This class is now part of vibe.d, see http://vibed.org/api/vibe.stream.stdio/StdFileStream
class StdFileStream : ConnectionStream {
private {
std.stdio.File m_file;
TaskPipe m_readPipe;
TaskPipe m_writePipe;
Thread m_readThread;
Thread m_writeThread;
}