Skip to content

Instantly share code, notes, and snippets.

View moonhouse's full-sized avatar

David Hall moonhouse

View GitHub Profile
#!/bin/bash
set -e
CONTENTS=$(tesseract -c language_model_penalty_non_dict_word=0.8 --tessdata-dir /usr/local/share/tessdata/ "$1" stdout -l eng | xml esc)
hex=$((cat <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
@sanderploegsma
sanderploegsma / BeamExamples.java
Last active October 9, 2019 13:14
Apache Beam + Kotlin examples
class BeamExamples {
public PCollection<Person> filterByAge(PCollection<Person> input, int age) {
return input.apply("Filter by age", Filter.by(p -> p.getAge() >= age));
}
}
@stecman
stecman / _readme.md
Last active April 25, 2024 00:10
Brother P-Touch PT-P300BT bluetooth driver python

Controlling the Brother P-Touch Cube label maker from a computer

The Brother PTP300BT label maker is intended to be controlled using the official Brother P-Touch Design & Print iOS/Android app. The app has arbitrary limits on what you can print (1 text object and up to 3 preset icons), so I thought it would be a fun challenge to reverse engineer the protocol to print whatever I wanted.

Python code at the bottom if you want to skip the fine details.

Process

Intitially I had a quick peek at the Android APK to see if there was any useful information inside. The code that handles the communication with the printer in Print&Design turned out to be a native library, but the app clearly prepares a bitmap image and passes it to this native library for printing. Bitmaps are definitely something we can work with.

@PaulKinlan
PaulKinlan / canvasrecord.js
Last active August 9, 2022 11:55
Screen recorder in JS
(function() {
let canvas = document.querySelector('canvas');
// Optional frames per second argument.
let stream = canvas.captureStream(25);
var options = {mimeType: 'video/webm; codecs=vp9'};
let recorder = new MediaRecorder(stream, options);
let blobs = [];
function download(blob) {
var url = window.URL.createObjectURL(blob);
@peterdalle
peterdalle / swedish-stopwords.txt
Last active October 8, 2021 10:46
Svenska stoppord (Swedish stop words) - se https://github.com/peterdalle/svensktext för uppdaterad version
aderton
adertonde
adjö
aldrig
all
alla
allas
allt
alltid
alltså
@veselosky
veselosky / s3gzip.py
Last active May 8, 2023 21:42
How to store and retrieve gzip-compressed objects in AWS S3
# vim: set fileencoding=utf-8 :
#
# How to store and retrieve gzip-compressed objects in AWS S3
###########################################################################
#
# Copyright 2015 Vince Veselosky and contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@andreasronge
andreasronge / Gemfile
Last active August 29, 2015 14:00
Example how to deploy Neo4j.rb / neo4j-core app on heroku
source "https://rubygems.org"
ruby "2.1.1"
gem 'sinatra', '1.1.0'
gem 'neo4j-core', '3.0.0.alpha.11'
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active April 25, 2024 02:01
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

@bvasiles
bvasiles / stackoverflow.bib
Last active July 2, 2019 16:50
Bibliography of academic papers using Stack Overflow data, in BibTeX format. Ideally it should contain all papers listed on http://meta.stackoverflow.com/questions/134495/academic-papers-using-stack-overflow-data
%% Saved with string encoding Unicode (UTF-8)
@inproceedings{Gkotsis2014Content,
title={It's all in the content: state of the art best answer prediction based on discretisation of shallow linguistic features},
author={Gkotsis, George and Stepanyan, Karen and Pedrinaci, Carlos and Domingue, John and Liakata, Maria},
booktitle={Proceedings of the 2014 ACM Conference on Web Science (WebSci)},
pages={202--210},
year={2014},
organization={ACM}
}