Skip to content

Instantly share code, notes, and snippets.

@greenbreakfast
greenbreakfast / autorun.sh
Created June 30, 2020 15:12
Omega2 USB Autorun script to connect to a WiFi network, wait until connected, and then do something that needs the internet
#!/bin/sh
printf "%s" "Connecting to WiFi"
wifisetup add -ssid Network-SSID -encr wpa2 -password XXXXXXXX
printf "%s" "Waiting for Internet"
while ! ping -c 1 -n -w 1 www.google.com &> /dev/null
do
printf "%c" "."
done
#!/bin/sh /etc/rc.common
# Copyright (C) 2019 Onion Corporation
START=90
USE_PROCD=1
start_service() {
procd_open_instance
procd_set_param command python3 /root/location.py
@greenbreakfast
greenbreakfast / iotSensor.py
Last active July 14, 2019 01:05
How to Build IoT Sensors using Python
import time
import os
# Import the ADC Expansion module.
from OmegaExpansion import AdcExp
# create ADC Expansion object
adc = AdcExp.AdcExp()
#infinite loop to read sensors and display data
@greenbreakfast
greenbreakfast / example-service
Last active May 29, 2018 02:37
Example Omega2 /etc/init.d service script
#!/bin/sh /etc/rc.common
# Copyright (C) 2018 Onion Corporation
START=90
USE_PROCD=1
start_service() {
procd_open_instance
procd_set_param command [YOUR COMMAND HERE]
@greenbreakfast
greenbreakfast / setupSpiBitbang.sh
Created October 24, 2017 02:50
Script to configure a software bit-banged SPI interface on the Omega2
#!/bin/sh
## insmod spi-gpio-custom bus%d=%d,%d,%d,%d,%d,%d,%d
## From OnionIoT/spi-gpio-driver:
##
# sprintf(cmd, SPI_DEV_INSMOD_TEMPLATE, params->busNum, params->deviceId,
# params->sckGpio,
# params->mosiGpio,
# params->misoGpio,
@greenbreakfast
greenbreakfast / xCompile-toolchain.sh
Created October 4, 2017 17:23
Script for cross-compiling using Omega2-Toolchain Docker Image
#!/bin/bash
# define the usage
usage () {
echo "Arguments:"
echo " -toolchain <path to buildroot>"
echo " -lib \"<list of additional libraries to link in compile>\""
echo ""
}
@greenbreakfast
greenbreakfast / Onion-Cloud-SDK-Outline.md
Last active June 10, 2016 18:48
Outline for the Beta release of the Onion Cloud SDK

Onion Cloud SDK

An outline of the contents of the Beta release of the Onion Cloud SDK

Introduction

  • Intro to the Onion Cloud
  • Using the SDK
    • What it can teach you
  • What you will be able to accomplish with it
@greenbreakfast
greenbreakfast / cmd1
Last active March 25, 2016 01:21
bluez config
ls -al -R /etc/dbus-1
/etc/dbus-1:
drwxr-xr-x 4 root root 4096 Mar 15 01:18 .
drwxr-xr-x 1 root root 4096 Mar 15 01:18 ..
-rw-r--r-- 1 root root 2883 Sep 9 2015 session.conf
drwxr-xr-x 2 root root 4096 Sep 9 2015 session.d
-rw-r--r-- 1 root root 4177 Sep 9 2015 system.conf
drwxr-xr-x 2 root root 4096 Mar 15 01:18 system.d
/etc/dbus-1/session.d: