Skip to content

Instantly share code, notes, and snippets.

@a2f0
a2f0 / stats_logger.rb
Created March 26, 2019 01:48 — forked from LeZuse/stats_logger.rb
Puma plugin for stats logging on Heroku
Puma::Plugin.create do
def production?
ENV.fetch('RACK_ENV', 'development') == 'production'
end
def log(msg)
if production?
Rails.logger.info msg
else
puts msg
pi@raspberrypi:~ $ time /home/pi/libssp/1.30/sample/stillsample/stillsample '/home/pi/libssp/1.30/sample/profiles/IMX378_640x480_4x4.xml' ~/whatever.raw
Setting summary: 640 x 480 @ 15 fps 10 bits
Running on Pi 3 Model B
Warning; camera_settings.CameraNo does not support >1 unless Compute module 3. Corrected to 0.
PowerOn Reset...Done.
Write i2c: reg:e000 val:00
Write i2c: reg:4ae9 val:18
Write i2c: reg:4aea val:08
Write i2c: reg:f61c val:04
Write i2c: reg:f61e val:04
pi@raspberrypi:~ $ i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- 1a -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- 3e --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: 50 51 52 53 54 55 56 57 -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
pi@raspberrypi:~ $ strace /home/pi/libssp/1.30/sample/stillsample/stillsample '/home/pi/libssp/1.30/sample/profiles/IMX378_3840x2160.xml' ~/whatever.raw
execve("/home/pi/libssp/1.30/sample/stillsample/stillsample", ["/home/pi/libssp/1.30/sample/stil"..., "/home/pi/libssp/1.30/sample/prof"..., "/home/pi/whatever.raw"], [/* 18 vars */]) = 0
brk(NULL) = 0x1f93000
uname({sysname="Linux", nodename="raspberrypi", ...}) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
mmap2(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x76f84000
access("/etc/ld.so.preload", R_OK) = 0
open("/etc/ld.so.preload", O_RDONLY|O_CLOEXEC) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=42, ...}) = 0
mmap2(NULL, 42, PROT_READ|PROT_WRITE, MAP_PRIVATE, 3, 0) = 0x76f83000
pi@raspberrypi:~ $ /home/pi/libssp/1.30/sample/stillsample/stillsample '/home/pi/libssp/1.30/sample/profiles/IMX378_3840x2160.xml' ~/whatever.raw
Setting summary: 3840 x 2160 @ 15 fps 10 bits
Running on Pi 3 Model B
Warning; camera_settings.CameraNo does not support >1 unless Compute module 3. Corrected to 0.
PowerOn Reset...Done.
Write i2c: reg:e000 val:00
Write i2c: reg:4ae9 val:18
Write i2c: reg:4aea val:08
Write i2c: reg:f61c val:04
Write i2c: reg:f61e val:04
@a2f0
a2f0 / gist:ce391c81c479f7be25e6fde5cd62e708
Last active May 19, 2019 20:13
Figaro CDM7160 continuous I2C read w/busy PIN (Python)
#!/usr/bin/env python
from smbus2 import SMBus, SMBusWrapper, i2c_msg
import time
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
INPUT_PIN = 8 #The BUSY pin.
GPIO.setup(INPUT_PIN, GPIO.IN)
def inputLow(channel):
@a2f0
a2f0 / gist:ec9382c61842caa79bb4ad43036efc4b
Created August 31, 2018 08:28
1000 Largest US Cities By Population With Geographic Coordinates, in CSV (from the JSON representation here: https://gist.github.com/Miserlou/c5cd8364bf9b2420bb29)
"city","growth_from_2000_to_2013","latitude","longitude","population","rank","state"
"New York","4.8%","40.7127837","-74.0059413","8405837","1","New York"
"Los Angeles","4.8%","34.0522342","-118.2436849","3884307","2","California"
"Chicago","-6.1%","41.8781136","-87.6297982","2718782","3","Illinois"
"Houston","11.0%","29.7604267","-95.3698028","2195914","4","Texas"
"Philadelphia","2.6%","39.9525839","-75.1652215","1553165","5","Pennsylvania"
"Phoenix","14.0%","33.4483771","-112.0740373","1513367","6","Arizona"
"San Antonio","21.0%","29.4241219","-98.49362819999999","1409019","7","Texas"
"San Diego","10.5%","32.715738","-117.1610838","1355896","8","California"
"Dallas","5.6%","32.7766642","-96.79698789999999","1257676","9","Texas"
message [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255]
message [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255]
message [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255]
message [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255]
message [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255]
message [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255]
message [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255]
message [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255]
message [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255]
message [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255]
+-----+-----+---------+------+---+---Pi 3---+---+------+---------+-----+-----+
| BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM |
+-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
| | | 3.3v | | | 1 || 2 | | | 5v | | |
| 2 | 8 | SDA.1 | ALT0 | 1 | 3 || 4 | | | 5v | | |
| 3 | 9 | SCL.1 | ALT0 | 1 | 5 || 6 | | | 0v | | |
| 4 | 7 | GPIO. 7 | IN | 1 | 7 || 8 | 1 | ALT0 | TxD | 15 | 14 |
| | | 0v | | | 9 || 10 | 1 | ALT0 | RxD | 16 | 15 |
| 17 | 0 | GPIO. 0 | ALT3 | 1 | 11 || 12 | 1 | IN | GPIO. 1 | 1 | 18 |
apt-get update
apt-get install curl libunwind8 gettext apt-transport-https -y
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-jessie-prod jessie main" > /etc/apt/sources.list.d/dotnetdev.list'
apt-get update
==