Skip to content

Instantly share code, notes, and snippets.

@elfgoh
elfgoh / strace.log
Created March 9, 2017 03:25
strace log for debugging Adafruit_BBIO PWM issues
# cat strace.log
1762 execve("/usr/bin/python3.4", ["python3.4"], [/* 15 vars */]) = 0
1762 brk(0) = 0x110e000
1762 uname({sys="Linux", node="spdibox-3716BBBK0D3E", ...}) = 0
1762 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
1762 mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6fcd000
1762 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
1762 open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
1762 fstat64(3, {st_mode=S_IFREG|0644, st_size=17658, ...}) = 0
1762 mmap2(NULL, 17658, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb6fc8000
@elfgoh
elfgoh / pre_commit
Created September 29, 2016 17:06
A simple git pre-commit hook that checks if any public keys in the current directory with extension .pub is secure
#!/bin/sh
# A simple git pre-commit hook that checks if any public keys in the current directory with extension .pub is secure
for i in $(ls pubkeys/*.pub)
do
# DSA is insecure
f=$(ssh-keygen -l -f $i | cut -d "(" -f2 | cut -d ")" -f1)
echo "$f"
[ "$f" = "DSA" ] && echo "DSA is insecure: $i" && exit 1
#RSA < 2096 bits is not that secure
@elfgoh
elfgoh / gist:f9b478a3f3e6db804fb3
Created October 25, 2014 05:12
VC0706 library verify method
uint8_t VC0706::_verify(uint8_t cmd)
{
if((vcBuff[VC0706_PTL_BYTE] != VC0706_RECV_MARK) ||
(vcBuff[VC0706_SERIAL_BYTE] != VC0706_SERIAL_NUMBER)){
DBG("return format error\n");
return RESP_DATA_FORMAT_ERROR;
}
if(vcBuff[VC0706_CMD_BYTE] != cmd){
DBG("return command error\n");
@elfgoh
elfgoh / gist:298724f27df9c514354a
Last active August 29, 2015 14:08
VC0706 library motion detection method debugging
boolean VC0706::motionDetected(void)
{
if (_read(4, 200) != 4) {
Serial.println("in read");
return false;
}
if (!_verify(VC0706_COMM_MOTION_DETECTED)){
Serial.println("in verify");
Serial.println(_verify(VC0706_COMM_MOTION_DETECTED));
@elfgoh
elfgoh / gist:8795ad30595ab2e3fa5a
Created October 25, 2014 04:51
Seeed camera shield motion detection
#include "SoftwareSerial.h"
#include <VC0706_UART.h>
#include <SD.h>
#include <SPI.h>
#define SS_SD 10
//use software serial
SoftwareSerial cameraconnection(2,3);//Rx, Tx
VC0706 cam = VC0706(&cameraconnection);
//use hardware serial