Look at LSB init scripts for more information.
Copy to /etc/init.d
:
# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
// Requires NodeJS and "noble" module: https://github.com/sandeepmistry/noble | |
// Based on: https://github.com/sandeepmistry/noble/issues/62 | |
var noble = require('noble'); | |
noble.on('stateChange', function(state) { | |
if (state === 'poweredOn' ) { | |
noble.startScanning([], false); | |
} else { | |
noble.stopScanning(); | |
} |
import paho.mqtt.client as mqtt | |
# The callback for when the client receives a CONNACK response from the server. | |
def on_connect(client, userdata, rc): | |
print("Connected with result code "+str(rc)) | |
# Subscribing in on_connect() means that if we lose the connection and | |
# reconnect then subscriptions will be renewed. | |
client.subscribe("hello/world") | |
# The callback for when a PUBLISH message is received from the server. |
sudo apt-get install tightvncserver | |
sudo nano /etc/init.d/tightvncserver | |
sudo chmod 755 /etc/init.d/tightvncserver | |
sudo update-rc.d tightvncserver defaults | |
# run tightvncserver |
// the setup function runs once when you press reset or power the board | |
void setup() { | |
// initialize digital pin 13 as an output. | |
pinMode(13, OUTPUT); | |
} | |
// the loop function runs over and over again forever | |
void loop() { | |
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level) | |
delay(1000); // wait for a second |
# | |
# Automatically generated file; DO NOT EDIT. | |
# OpenWrt Configuration | |
# | |
CONFIG_MODULES=y | |
CONFIG_HAVE_DOT_CONFIG=y | |
# CONFIG_TARGET_ppc44x is not set | |
# CONFIG_TARGET_realview is not set | |
# CONFIG_TARGET_arm64 is not set | |
# CONFIG_TARGET_sunxi is not set |
package main | |
import ( | |
"fmt" | |
"encoding/hex" | |
"strconv" | |
) | |
func main() { | |
a := []byte{0xFF, 0xFA} // []byte{255, 250} |
#!/bin/sh | |
# | |
case "$1" in | |
start ) | |
echo -n "Starting Node Services: " | |
sleep 5 | |
cd /usr/bin/ | |
./core > /tmp/core.log 2>&1 & | |
sleep 2 | |
cd /root/node-red |
// refer to http://stackoverflow.com/questions/8286806/go-programming-language-mutual-concurrent-execution | |
// https://gobyexample.com/mutexes | |
package main | |
import "sync" | |
var m sync.Mutex | |
var wg sync.WaitGroup | |
func routine1() { |
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: mosquitto | |
# Required-Start: $remote_fs $syslog | |
# Required-Stop: $remote_fs $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: mosquitto MQTT v3.1 message broker | |
# Description: |
Look at LSB init scripts for more information.
Copy to /etc/init.d
:
# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)