Skip to content

Instantly share code, notes, and snippets.

@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
@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: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 / 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 / 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 / gist:5dc11cb9d3ba1ef985fa560e9d9a6ade
Created March 9, 2017 05:31
Dmesg output from BBB debian console image reboot
# dmesg
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Initializing cgroup subsys cpuacct
[ 0.000000] Linux version 4.4.48-ti-r88 (root@b1-omap5-uevm-2gb) (gcc version 4.9.2 (Debian 4.9.2-10) ) #1 SMP Sun Feb 12 01:06:00 UTC 2017
[ 0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c5387d
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] Machine model: TI AM335x BeagleBone Black
[ 0.000000] cma: Reserved 48 MiB at 0x9c800000
@elfgoh
elfgoh / uEnv.txt
Created March 9, 2017 05:49
/boot/uEnv.txt for BBB Debian console image
# cat /boot/uEnv.txt
#Docs: http://elinux.org/Beagleboard:U-boot_partitioning_layout_2.0
uname_r=4.4.48-ti-r88
#uuid=
#dtb=
##BeagleBone Black/Green dtb's for v4.1.x (BeagleBone White just works..)
##BeagleBone Black: HDMI (Audio/Video) disabled:
@elfgoh
elfgoh / gist:1f71b30e48d59711584c885390d43e2a
Last active March 10, 2017 02:19
strace output from python on BBB console image
# cat trace.txt
14432 execve("/usr/bin/python3.4", ["python3.4"], [/* 15 vars */]) = 0
14432 brk(0) = 0x1f18000
14432 uname({sys="Linux", node="spdibox-3716BBBK0D3E", ...}) = 0
14432 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
14432 mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6f59000
14432 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
14432 open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
14432 fstat64(3, {st_mode=S_IFREG|0644, st_size=17658, ...}) = 0
14432 mmap2(NULL, 17658, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb6f54000
@elfgoh
elfgoh / gist:b1c062b04b70f3e2793ebd2bf2229cb0
Created March 10, 2017 02:27
Dmesg output after fresh reboot of console image and installing bb-cape-overlays 09 Mar 2017
# dmesg
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Initializing cgroup subsys cpuacct
[ 0.000000] Linux version 4.4.48-ti-r88 (root@b1-omap5-uevm-2gb) (gcc version 4.9.2 (Debian 4.9.2-10) ) #1 SMP Sun Feb 12 01:06:00 UTC 2017
[ 0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c5387d
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] Machine model: TI AM335x BeagleBone Black
[ 0.000000] cma: Reserved 48 MiB at 0x9c800000
@elfgoh
elfgoh / cfv.txt
Last active June 6, 2017 02:37
Geekcampsg call for volunteers
We are looking for volunteers to join us in organising GeekcampSG 2017[1]. It is essentially a community conference for geeks covering both software and hardware.
We are looking for each volunteer to take up a tiny portfolio, and hopefully more than 1 volunteer per portfolio for redundancy. First timers welcomed and mentorship will be provided if needed. Please let me know if you are interested to help, or be a speaker!
Off the top of our heads, these are the areas where help is needed:
- accounting + finance
- afterparty
- design
- Emcee