Skip to content

Instantly share code, notes, and snippets.

View kevinhughes27's full-sized avatar

Kevin Hughes kevinhughes27

View GitHub Profile
@kevinhughes27
kevinhughes27 / opencv_blackfly.cpp
Last active January 24, 2024 19:39
A simple program showing how to capture from a Point Grey Research Camera and display the image using OpenCV
#include "FlyCapture2.h"
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
using namespace FlyCapture2;
int main()
@kevinhughes27
kevinhughes27 / eigen3_snips.cpp
Last active July 22, 2023 00:15
Eigen3 Snips
using namespace Eigen;
// these are the typedefs I like to work with
typedef Matrix< double, Dynamic, 1, ColMajor > EVector;
typedef Matrix< double, Dynamic, Dynamic, ColMajor > EMatrix;
// Mean
EVector mean = X.rowwise().sum() / X.rows();
// Standard Deviation
@kevinhughes27
kevinhughes27 / Makefile
Created April 4, 2013 15:51
g++ Makefile for OpenCV Project
CC = g++
CFLAGS = -g -Wall
SRCS = HelloWorld.cpp
PROG = HelloWorld
OPENCV = `pkg-config opencv --cflags --libs`
LIBS = $(OPENCV)
$(PROG):$(SRCS)
$(CC) $(CFLAGS) -o $(PROG) $(SRCS) $(LIBS)
@kevinhughes27
kevinhughes27 / the_arborist.rb
Last active January 7, 2022 22:53
find un-deleted branches from closed PRs
#!/usr/bin/env ruby
require 'octokit'
require 'highline/import'
require 'colorize'
require 'byebug'
require 'csv'
require 'active_support/time'
username = ask("Enter your Github username: ") { |q| q.echo = true }
@kevinhughes27
kevinhughes27 / product_update
Created April 3, 2014 16:20
update shopify product inventory with the API
I start by getting the product data from Shopify for the product in question, you might already have this data in your database. Using the Shopify API gem for ruby this looks like:
ruby > product = ShopifyAPI::Product.find(183524354)
which returns the following JSON:
{"body_html":"A Baseball Cap","created_at":"2014-03-14T19:25:19-04:00","handle":"moose","id":183524354,"product_type":"hat","published_at":"2014-03-14T19:25:05-04:00","published_scope":"global","template_suffix":null,"title":"Hat","updated_at":"2014-04-03T12:06:34-04:00","vendor":"kevins_sweet_test_shop","tags":"","variants":[{"barcode":null,"compare_at_price":null,"created_at":"2014-03-14T19:25:19-04:00","fulfillment_service":"manual","grams":0,"id":419761934,"inventory_management":"shopify","inventory_policy":"deny","option1":"Red","option2":null,"option3":null,"position":1,"price":"10.00","product_id":183524354,"requires_shipping":true,"sku":"","taxable":true,"title":"Red","updated_at":"2014-04-03T12:06:34-04:00","inventory_quantity":10,"old
@kevinhughes27
kevinhughes27 / wat.rb
Created July 28, 2018 14:50
A trailing comma in a list of attr_reader hijacks the next method definition. How is this not a syntax error?
class Wat
def initialize(thing)
@thing = thing
@foo = 'foo'
end
# this ends up creating an attr_reader for foo
# but shouldn't it throw an error when it
# sees `def` after a comma?
attr_reader :thing,
@kevinhughes27
kevinhughes27 / opencv.pro
Created April 4, 2013 15:54
Add OpenCV to Qt Creator Project
# add these lines to your .pro file
INCLUDEPATH += /usr/local/lib
LIBS +=`pkg-config opencv --cflags --libs`
@kevinhughes27
kevinhughes27 / Makefile
Created April 4, 2013 15:48
MinGW Makefile for OpenCV Project
CC = g++
CFLAGS = -g -Wall
SRCS = HelloWorld.cpp
PROG = HelloWorld.exe
OPENCV = -I"C:\opencv\build\include" -L"C:\opencv\build\x86\mingw\lib" -lopencv_core243 -lopencv_highgui243
$(PROG) : $(SRCS)
$(CC) $(CFLAGS) -o $(PROG) $(SRCS) $(OPENCV)

Keybase proof

I hereby claim:

  • I am kevinhughes27 on github.
  • I am kevinhughes27 (https://keybase.io/kevinhughes27) on keybase.
  • I have a public key whose fingerprint is B263 BCD7 178F 9223 124C 6776 4753 1019 ABDA FEE7

To claim this, I am signing this object:

@kevinhughes27
kevinhughes27 / sleepy-bash.sh
Last active April 2, 2017 04:18
bash sleep prank
#!/usr/bin/env bash
# sleepy-bash
# kevin hughes
# kevinhughes27@gmail.com
# 2015
# on each run this script reads a var increments
# it then sleeps for that long.