Skip to content

Instantly share code, notes, and snippets.

View Laeeth's full-sized avatar

Laeeth Isharc Laeeth

View GitHub Profile
@Laeeth
Laeeth / fetch_page.py
Last active August 29, 2015 14:27 — forked from Smerity/fetch_page.py
An example of fetching a page from Common Crawl using the Common Crawl Index
import gzip
import json
import requests
try:
from cStringIO import StringIO
except:
from StringIO import StringIO
# Let's fetch the Common Crawl FAQ using the CC index
resp = requests.get('http://index.commoncrawl.org/CC-MAIN-2015-27-index?url=http%3A%2F%2Fcommoncrawl.org%2Ffaqs%2F&output=json')
@Laeeth
Laeeth / arrayOp.d
Last active September 11, 2015 22:02 — forked from MartinNowak/arrayOp.d
pure:
nothrow:
// T[] = T[] op T[]
void arrayOp(string op, T)(T[] res, in T[] a, in T[] b)
in
{
assert(res.length == a.length);
assert(res.length == b.length);
}
@Laeeth
Laeeth / latency.txt
Created October 27, 2015 02:57 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms
Read 4K randomly from SSD* 150,000 ns 0.15 ms
@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;
}
@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 / 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

#!/usr/bin/env bash
# Loads and mounts an ISO over SMB via the
# SuperMicro IPMI web interface
#
# usage: supermicro-mount-iso.sh <ipmi-host> <smb-host> <path>
# e.g.: supermicro-mount-iso.sh 10.0.0.1 10.0.0.2 '\foo\bar\windows.iso'
set -x
@Laeeth
Laeeth / dhcp_snooping.sh
Created June 3, 2019 14:28 — forked from ericpulvino/dhcp_snooping.sh
Quick Script to Emulate Basic DHCP Trusted Ports / DHCP Snooping / DHCP Filtration
#!/bin/bash
# Root Check
if [ $(whoami) != 'root' ]; then
echo "ERROR: Must be root to run $0"
exit 1;
fi
TRUSTED_PORTS=( swp1 swp3 )
@Laeeth
Laeeth / article.md
Created July 16, 2019 15:33 — forked from MIvanchev/article.md
Ever wondered what it takes to run Windows software on ARM? Then this article might be for you!
@Laeeth
Laeeth / imap-search
Created December 23, 2019 01:56 — forked from martinrusev/imap-search
IMAP Search criteria