Skip to content

Instantly share code, notes, and snippets.

@rwb27
rwb27 / set_picamera_gain.py
Last active April 27, 2023 15:09
Manually setting gain of raspberry pi camera from within python
from __future__ import print_function
import picamera
from picamera import mmal, mmalobj, exc
from picamera.mmalobj import to_rational
import time
MMAL_PARAMETER_ANALOG_GAIN = mmal.MMAL_PARAMETER_GROUP_CAMERA + 0x59
MMAL_PARAMETER_DIGITAL_GAIN = mmal.MMAL_PARAMETER_GROUP_CAMERA + 0x5A
@sorah
sorah / spec_helper.rb
Created December 17, 2012 01:34
Show warnings for examples that has no expectations
RSpec.configure do |config|
config.after(:each) do
result = self.example.metadata[:execution_result]
has_mock_expectations = RSpec::Mocks.space.instance_eval{receivers}.empty?
if !result[:exception] && !result[:pending_message] && !RSpec::Matchers.last_should && hasnt_mock_expectations
$stderr.puts "[WARN] No expectations found in example at #{self.example.location}: Maybe you forgot to write `should` in the example?"
end
end
end