Skip to content

Instantly share code, notes, and snippets.

View bensie's full-sized avatar

James Miller bensie

View GitHub Profile
NSData *jpeg = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageDataSampleBuffer] ;
CGImageSourceRef source ;
source = CGImageSourceCreateWithData((CFDataRef)jpeg, NULL);
//get all the metadata in the image
NSDictionary *metadata = (NSDictionary *) CGImageSourceCopyPropertiesAtIndex(source,0,NULL);
//make the metadata dictionary mutable so we can add properties to it
NSMutableDictionary *metadataAsMutable = [[metadata mutableCopy]autorelease];
$ gphoto2 --get-config colortemperature --set-config colortemperature=4700 --debug --debug-logfile=xx.log
Label: Color Temperature
Type: TEXT
Current: 5000
$ cat xx.log
0.000887 main(2): ALWAYS INCLUDE THE FOLLOWING LINES WHEN SENDING DEBUG MESSAGES TO THE MAILING LIST:
0.001337 main(2): gphoto2 2.5.2
0.001571 main(2): gphoto2 has been compiled with the following options:
0.001688 main(2): + gcc (C compiler used)
0.001758 main(2): + popt (mandatory, for handling command-line parameters)
@bensie
bensie / eos550d
Created July 7, 2013 04:17
Camera Summaries - `gphoto2 --debug --summary`
0.000726 main(2): ALWAYS INCLUDE THE FOLLOWING LINES WHEN SENDING DEBUG MESSAGES TO THE MAILING LIST:
0.002714 main(2): gphoto2 2.5.2
0.004418 main(2): gphoto2 has been compiled with the following options:
0.005955 main(2): + gcc (C compiler used)
0.007421 main(2): + popt (mandatory, for handling command-line parameters)
0.008819 main(2): + exif (for displaying EXIF information)
0.009623 main(2): + no cdk (for accessing configuration options)
0.009776 main(2): + no aa (for displaying live previews)
0.009944 main(2): + no jpeg (for displaying live previews in JPEG format)
0.010097 main(2): + no readline (for easy navigation in the shell)
@bensie
bensie / formotion.rb
Created June 18, 2013 23:40
Formotion dynamic select_one
@form = Formotion::Form.new({
sections: [
{
select_one: true,
rows: value["choices"].map do |choice|
{
title: choice["description"],
key: choice["description"],
value: value["current"] == choice["description"],
type: :check
@bensie
bensie / es.json
Last active December 17, 2015 21:29
{
"from": 0,
"size": 30,
"query": {
"filtered": {
"filter": {
"and": [
{
"or": [
{
package main
import (
"bytes"
"exec"
"log"
"os"
)
// Pipeline strings together the given exec.Cmd commands in a similar fashion
@bensie
bensie / postmark_scrape.rb
Created December 17, 2012 00:15
Scrape Postmark outbound for all emails sent - capture address, subject, and timestamp and write to JSON
require "mechanize"
require "nokogiri"
require "json"
emails = []
a = Mechanize.new
a.get("https://postmarkapp.com/login") do |login_page|
servers_page = login_page.form_with(:id => 'new_user_session') do |form|
form.send "user_session[login]", ARGV[0]
"products" : {
"product" : {
"properties" : {
"id" : {
"type" : "string",
"index" : "not_analyzed"
},
"product_name" : {
"type" : "string",
"analyzer" : "keyword"
@bensie
bensie / base.rb
Created December 6, 2012 17:53
Sinatra API Helpers
require "sinatra/base"
require "sinatra/namespace"
require "multi_json"
require "api/authentication"
require "api/error_handling"
require "api/pagination"
module Api
class Base < ::Sinatra::Base
@bensie
bensie / gphoto2-single
Created November 9, 2012 23:30
gphoto2-interval
james@ubuntu:~$ time gphoto2 --capture-image-and-download --force-overwrite --filename='foo.jpg' --frames=3 --interval=5
Time-lapse mode enabled (interval: 5s).
Capturing frame #1/3...
New file is in location /capt0000.jpg on the camera
Saving file as foo.jpg
Deleting file /capt0000.jpg on the camera
Deleting 'capt0000.jpg' from folder '/'...
Waiting for next capture slot 3 seconds...
Capturing frame #2/3...
New file is in location /capt0001.jpg on the camera