Skip to content

Instantly share code, notes, and snippets.

View forslund's full-sized avatar
🌙

Åke forslund

🌙
View GitHub Profile
#!/opt/venvs/mycroft-core/bin/python
from mycroft.messagebus.send import send
send('mycroft.wifi.start')
print("""=====================================================================
Wifi setup has begun. Use your phone, tablet or laptop to connect to
the network 'MYCROFT' using the password '12345678'. Once connected
browse to 'https://start.mycroft.ai', then follow the prompts to
complete the setup.
=====================================================================
import json
from adapt.intent import IntentBuilder
from adapt.engine import IntentDeterminationEngine
from adapt.context import ContextManager
engine = IntentDeterminationEngine()
context_manager = ContextManager()
# define vocabulary
import pyaudio
pa = pyaudio.PyAudio()
print('\n\n\n==========================================\nFound devices:')
for device_index in range(pa.get_device_count()):
dev = pa.get_device_info_by_index(device_index)
if dev['maxInputChannels'] > 0:
print('{}: Samplerate {} Channels {}'.format(dev['name'],
dev['defaultSampleRate'],
dev['maxInputChannels']))
@forslund
forslund / aarch64-instructions.md
Last active June 20, 2023 11:18
Mycroft-Precise on aarch64

Set up environment

  • Setup 2 GB swap
  • Make sure there's room in /tmp ( > 2 GB)

Install python 3.5

To be able to use the prebuild wheel of tensorflow python 3.5 is needed.

Install prerequisites

@forslund
forslund / bad_class_var.py
Created August 22, 2019 07:54
Python class variables test
class C:
class_var = None
def __init__(self):
if self.class_var is None:
self.class_var = [1]
print('Creating new instance')
else:
print('Appending to existing')
self.class_var.append(1)
#include <stdio.h>
#include <string.h>
void show_icon(const char *code)
{
static char msgHold[31] = {0};
char icon[91];
//Arduinos have a hardcoded limit of 64 bytes for their serial input
//buffer. To get around this Mycroft sends large messages as two parts.
@forslund
forslund / intent2feature.py
Created January 20, 2020 14:08
Converter script converting Mycroft skill intent tests to behave features
import json
from os.path import join
from pathlib import Path
import sys
TEMPLATE = """
Scenario: {name}
Given the skill path "{skill_path}"
When the user says "{utterance}"
@forslund
forslund / snapcraft.yaml
Last active March 24, 2020 07:36
precise-snap
name: mycroft-precise
version: 0.3.1
summary: Mycroft Precise
description: Mycroft Precise, a wake word spotter.
base: core18
confinement: strict
build-packages: [python3-dev, python3-setuptools, libtool, libffi-dev, libssl-dev, autoconf, build-essential]
parts:
alsa-mixin:
after: []
FROM ubuntu:xenial as builder
# Grab dependencies
RUN apt-get update && apt-get dist-upgrade --yes && apt-get install --yes \
curl \
jq \
squashfs-tools
# Grab the core snap (for backwards compatibility) from the stable channel and
# unpack it in the proper place.
@forslund
forslund / build.sh
Last active February 1, 2021 23:50
Example of Building Mark-2 packages
# General prerequisites:
sudo apt-get install -y debhelper build-essential fakeroot
# Clone package
git clone https://github.com/mycroft-packaging/mycroft-gui-mark-2 -b focal
cd mycroft-gui-mark-2
# Clone source
git clone https://github.com/mycroftai/mycroft-gui-mark-2
cp -r debian mycroft-gui-mark-2