Skip to content

Instantly share code, notes, and snippets.

@mcoms
mcoms / README.md
Created May 17, 2016 21:50
Eken H9 Action Camera Firmware

Official source for the latest firmware

Eken supply firmware for their H2, H2R, H3, H3R, H8, H8R, H9 and H9R cameras via the following site:

http://ftp.eken.com/

The "R" camera versions come with a remote control.

Selecting the right file

@mcoms
mcoms / custom_formatter.rb
Created June 12, 2017 20:07
When you're having a bad day and just want to skip every failing RSpec test
# frozen_string_literal: true
class CustomFormatter
RSpec::Core::Formatters.register self, :example_failed
def initialize(output)
@output = output
end
def example_failed(notification)
@mcoms
mcoms / Dockerfile
Created June 23, 2016 16:29
Dockerfile and docker-compose for Traccar GPS software
FROM java:alpine
RUN mkdir -p /usr/src/traccar
COPY . /usr/src/traccar
VOLUME /usr/src/traccar/data
WORKDIR /usr/src/traccar
EXPOSE 8082
EXPOSE 5001-5109
CMD ["java", "-jar", "tracker-server.jar", "conf/traccar.xml"]
@mcoms
mcoms / Gemfile
Created May 6, 2015 22:42
Fruit Piano prototype with MPR121, Arduino and Sonic Pi
source 'https://rubygems.org'
gem 'osc-ruby', '1.1.1'
gem 'serialport'
@mcoms
mcoms / late_invoices.csv
Created January 21, 2019 12:41
Takes the FreeAgent invoice table and generates a CSV file from it. Makes it easier to work with the data in a spreadsheet when calculating late payment fees.
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 7 columns, instead of 1. in line 1.
Issue Date,Due Date,Name,Client,Value,Status,Paid On
...
@mcoms
mcoms / Gemfile
Created June 6, 2017 18:29
Train a Markov chain on your tweets so you don't have to think of tweets anymore
# frozen_string_literal: true
source 'https://rubygems.org'
gem 'marky_markov', '~> 0.3.5'
gem 'twitter', '~> 6.1.0'
@mcoms
mcoms / 7.rb
Last active January 1, 2016 23:59
Where's the best place to buy 7?
require 'nokogiri'
require 'open-uri'
require 'json'
doc = Nokogiri::HTML(open('http://www.mysupermarket.co.uk/asda-compare-prices/Spirits/Havana_Club_Rum_Anejo_7_Year_Old_700ml.html'))
prices = doc.css('#PriceComparison .StoreDiv').map {|c| { name: c.css('.ImgSpan img').first['alt'], cheapest: c['class'].include?('Cheapest'), price: c.css('.Price>span.priceClass, .Price>span.Offer').text.strip } }
# => [{:name=>"ASDA", :cheapest=>true, :price=>"£18.00"},
# {:name=>"Tesco", :cheapest=>false, :price=>"£23.30"},
# {:name=>"Ocado", :cheapest=>false, :price=>"£23.30"},
@mcoms
mcoms / ideas.md
Created November 29, 2013 17:28
"What are some neat, small electronics projects for university students?"

Ideas

  • Digital radio transmitter or receiver
  • GPS/GPRS tracker
  • High atmosphere air current tracking using balloons, and a pi/arduino with GPS and recording
  • Launch something that goes out of sight, then track/find it using your favourite protocol
  • Amateur radio beacon hunting using your own equipment
  • SMS remote control
  • 555 timer based signal generator
  • Piezo based floor piano

RTL-SDR tips and tricks

Sample format

The output is IQ (quadrature) sampling. It's interleaved, so first byte is I, second Q and so on. The samples are unsigned bytes, so you subtract 127 from them to get their real ralue (lying between -127 and +127).

rtl_tcp control

Send a command byte followed by a 32-bit big-endian int parameter.

@mcoms
mcoms / keepass2pass.rb
Created January 29, 2013 18:00
This ruby script reads a KeePass XML export (v2) and inserts the entries into pass, the UNIX password manager. It will use a path starting with "KeePass/" so you can manually check the entries.
def find_path(entry)
path = []
until entry.parent.name == 'Root' do
entry = entry.parent
path.insert(0, entry.css('>Name').text)
end
path
end
def insert_entry(entry)