Skip to content

Instantly share code, notes, and snippets.

@threedaymonk
threedaymonk / detect.py
Created January 14, 2020 14:42
Python barcode reader example
#!/usr/bin/python3
from imutils.video import VideoStream
from pyzbar.pyzbar import decode
from pprint import pprint
import cv2
import time
vs = VideoStream(src=0).start()
time.sleep(1.0)
@threedaymonk
threedaymonk / post-install.sh
Last active December 31, 2019 23:12
Ubuntu post-install packages
#!/bin/bash
sudo apt update
sudo apt install -y \
apt-file \
autoconf \
bison \
build-essential \
checkinstall \
@threedaymonk
threedaymonk / install.sh
Last active November 4, 2017 12:48
Media PC Setup
# Start with Ubuntu server 9.10 32-bit
# Become root
sudo su
# Add XBMC repositories and install key
cat > /etc/apt/sources.list.d/xbmc.list <<END
deb http://ppa.launchpad.net/team-xbmc-svn/ppa/ubuntu karmic main
Constitution of a Charitable Incorporated Organisation whose only voting
members are its charity trustees
(‘Foundation’ model constitution)
Date of constitution (last amended):
...........................................................................
1. Name
@threedaymonk
threedaymonk / recipes.txt
Last active June 2, 2016 15:43
BBC Food recipe URLs
http://www.bbc.co.uk/food/recipes/10minutepizza_87314
http://www.bbc.co.uk/food/recipes/15_minute_pasta_33407
http://www.bbc.co.uk/food/recipes/3d_biscuits_29555
http://www.bbc.co.uk/food/recipes/3wayswithlemoncurd_67266
http://www.bbc.co.uk/food/recipes/_81487
http://www.bbc.co.uk/food/recipes/aberdeenbutteriesrow_92370
http://www.bbc.co.uk/food/recipes/abundant_steamed_sea_22932
http://www.bbc.co.uk/food/recipes/acaciahoneyglazedchi_83634
http://www.bbc.co.uk/food/recipes/ackeeandsaltfish_86812
http://www.bbc.co.uk/food/recipes/aclassicspongecakewi_9406
@threedaymonk
threedaymonk / annotate-failures.rb
Created March 29, 2016 08:59
Annotate failing Cucumber scenarios with @broken
failures = {}
ARGF.read.split(/\n/).each do |line|
matches = line.match(/\Acucumber ([^:]+):(\d+)/) or next
(failures[matches[1]] ||= []) << matches[2].to_i - 1
end
failures.each do |file, indices|
lines = File.readlines(file)
indices.reverse.each do |index|
indentation = lines[index][/\A\s+/]
@threedaymonk
threedaymonk / a
Last active January 20, 2016 11:30
Number of separate copies/versions of each npm module in the node_modules hierarchy
Unique versions of each module
8 glob
8 async
7 qs
7 lodash
7 commander
6 source-map
5 uglify-js
5 strip-ansi
@threedaymonk
threedaymonk / .gitignore
Last active January 3, 2016 22:29
Little Schemer group, chapter 1
*.pdf
*.dot
@threedaymonk
threedaymonk / avoid.md
Last active December 18, 2015 14:09
A list of overly-generic terms to avoid when naming variables and resources. More to come as I find them.
  • type
  • state
  • status
  • data (yes, and datum, datas, etc.)
  • correct, especially in tests. What is correctness in this context?
  • object
@threedaymonk
threedaymonk / _problem.md
Last active December 16, 2015 07:28
Hoodlums exercise suggested by Andres Löh.

From http://www.meetup.com/hoodlums/events/91349692/

Define a function cat that takes an arbitrary number of strings and returns the concatenation of all strings. You'll need the FlexibleInstances extension (but should not need any others). When calling in GHCi, you will have to annotate the result type of the function. Examples:

> cat :: String 
"" 
> cat "foo" "bar" :: String 
"foobar" 
> cat "Haskell" "Hoodlums" "Meetup" :: String