Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am mcrmfc on github.
  • I am mcrmfc (https://keybase.io/mcrmfc) on keybase.
  • I have a public key ASDIg8BxDeEW5vSo_S8HN2phpWUMs9UbxS09W-O_koodPgo

To claim this, I am signing this object:

#include "./HX711.h"
#include <stdlib.h> /* abs */
/********************************/
// include the library code
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 20, 4); // set the LCD address to 0x27 for a 16 chars and 2 line display
/*********************************************************/
HX711 scale;
@mcrmfc
mcrmfc / activesupport_json_issue.rb
Created May 27, 2016 10:24
Bug in activesupport json Set serialization?
require 'set'
require 'json'
p Set.new([1]).to_json
require 'active_support/all'
p Set.new([1]).to_json
@mcrmfc
mcrmfc / profile-with-cert-example.rb
Created May 25, 2016 15:56
Firefox Profile with Client Cert
require 'selenium/webdriver'
# How to run this test.
# Manually create a new firefox profile using the profile manager " /Applications/Firefox.app/Contents/MacOS/firefox-bin -P"
# Import your p12 BUT DO NOT SET A MASTER PASSWORD
# Move cert8.db key3.db from that profile to the same directory as this script e.g.
# cp ~/Library/Application\ Support/Firefox/Profiles/4k2ob3bb.webdrivertest/*.db .
# NOTE: DO NOT USE YOUR OWN CERT IN CI!!!!
# In order to use this in CI get whoever provisions your CI box to provision an app cert in this format
# In theory it should be possible to do this on the command line using Mozilla nsutil - but it's very fussy about
# Purdie 'Sonic Pi' Shuffle
# https://careerdrummer.files.wordpress.com/2012/06/purdie-half-time-shuffle.jpg
def triplet(pattern = [1,1,1])
pattern.each { |pulse| yield if pulse; sleep 0.333 }
end
def quaver(pattern = [1,1])
pattern.each { |pulse| yield if pulse; sleep 0.5 }
end
@mcrmfc
mcrmfc / rpmcheat
Last active December 19, 2015 09:39
RPM Cheat
rpmbuild -bs <myrpm>.spec
mock -r epel-6-x86_64 --resultdir /home/vagrant/rpmbuild/RPMS --no-clean --no-cleanup-after --rebuild ~/rpmbuild/SRPMS/<myrpm>.src.rpm
cp ~/rpmbuild/RPMS/<myrpm>.noarch.rpm ~/localrepo
createrepo --update ~/localrepo
yum --enablerepo=localrepo clean all
sudo createrepo --update /home/vagrant/localrepo
@mcrmfc
mcrmfc / tcpdump
Created June 26, 2012 10:41
tcpdump local
#captures everything on loopback port 80 and dump to log
tcpdump -i lo port 80 -s 0 -w capture.log
@mcrmfc
mcrmfc / ruby_vars.rb
Created April 29, 2012 22:09
variables in ruby
class A
@@class_var = 'aclassvar'
@class_instance_var = 'aclassinstancevar'
def initialize
@instance_var = 'ainstance_var'
end
def A.class_method
@mcrmfc
mcrmfc / closures_in_ruby.rb
Created April 19, 2012 13:03
Closures In Ruby - Paul Cantrell
# CLOSURES IN RUBY Paul Cantrell http://innig.net
# Email: username "cantrell", domain name "pobox.com"
# I recommend executing this file, then reading it alongside its output.
#
# Alteratively, you can give yourself a sort of Ruby test by deleting all the comments,
# then trying to guess the output of the code!
# A closure is a block of code which meets three criteria:
#
@mcrmfc
mcrmfc / patch_from_diff
Created January 11, 2012 16:51
diff and patch cheat sheet
svn diff --diff-cmd /usr/bin/diff -x "-i -b" > mypatch
...
patch -p0 < mypatch
#easy diff
svn di -c 668582 https://repo.dev.bbc.co.uk | vim -R -