Skip to content

Instantly share code, notes, and snippets.

View sel's full-sized avatar

Steve Larkin sel

  • Malmö, Sweden
View GitHub Profile
#!/usr/bin/awk -f
# This program is a copy of guff, a plot device. https://github.com/silentbicycle/guff
# My copy here is written in awk instead of C, has no compelling benefit.
# Public domain. @thingskatedid
# Run as awk -v x=xyz ... or env variables for stuff?
# Assumptions: the data is evenly spaced along the x-axis
# TODO: moving average
@fnky
fnky / ANSI.md
Last active June 29, 2024 06:15
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27

pprof

With a single import _ "net/http/pprof" you can add profiling endpoints to a HTTP server.

package main

import (
	"fmt"

⚠️ this is now stupidly out of date

Computers

  • 13" Macbook Pro 3.3 GHz i7 (late 2016)
  • Microsoft Surface Book (2016)

Peripherals

@dannguyen
dannguyen / README.md
Last active May 17, 2024 02:07
Using Python 3.x and Google Cloud Vision API to OCR scanned documents to extract structured data

Using Python 3 + 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

@UnkindPartition
UnkindPartition / cleanup.sh
Created March 11, 2016 21:27
Clean up stale .sdr files from Kindle (paperwhite)
#!/bin/sh
# Call this from your 'documents' directory
set -eu
for d in *.sdr
do
if [ -d "$d" -a ! -n "$(find . -maxdepth 1 -type f -name "${d%.sdr}*" -print -quit)" ]
then
echo "$d"
@OR13
OR13 / change-google-apps-primary-domain.md
Last active June 5, 2018 20:28
How To Change Your Google Apps Primary Domain

How To Change Your Google Apps Primary Domain

These instructions will allow you to change your google apps for business primary domain without writing an code...

  1. Open this page in a new tab: https://developers.google.com/admin-sdk/directory/v1/reference/customers/update
  2. Click Try It
  3. Make sure you’re logged into your relevant Google account (you should see your mail address in the top right corner).
  4. Next to customerKey type: my_customer
  5. Next to fields type: customerDomain
@gtallen1187
gtallen1187 / slope_vs_starting.md
Created November 2, 2015 00:02
A little bit of slope makes up for a lot of y-intercept

"A little bit of slope makes up for a lot of y-intercept"

01/13/2012. From a lecture by Professor John Ousterhout at Stanford, class CS140

Here's today's thought for the weekend. A little bit of slope makes up for a lot of Y-intercept.

[Laughter]

@brijeshb42
brijeshb42 / app.py
Last active September 25, 2020 20:16
import os
import json
import datetime
from flask import Flask, url_for, redirect, \
render_template, session, request
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.login import LoginManager, login_required, login_user, \
logout_user, current_user, UserMixin
from requests_oauthlib import OAuth2Session
@laughinghan
laughinghan / InterVer.md
Last active January 6, 2024 07:22
Interface Versioning - Never break backcompat, keep the API nimble

Interface Versioning (InterVer)

Never break backcompat, keep the API nimble

An extension of SemVer with a stricter (yet more realistic) backcompat guarantee, that provides more flexibility to change the API, for libraries that are packaged and downloaded (not services accessed remotely over the Internet (see Note 4)).