Skip to content

Instantly share code, notes, and snippets.

🏠
In my loft!

Åke forslund

🏠
In my loft!
Block or report user

Report or block forslund

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@forslund
forslund / bad_class_var.py
Created Aug 22, 2019
Python class variables test
View bad_class_var.py
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)
@forslund
forslund / aarch64-instructions.md
Last active May 17, 2019
Mycroft-Precise on aarch64
View aarch64-instructions.md

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

View list_inputs.py
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']))
View context_test.py
import json
from adapt.intent import IntentBuilder
from adapt.engine import IntentDeterminationEngine
from adapt.context import ContextManager
engine = IntentDeterminationEngine()
context_manager = ContextManager()
# define vocabulary
View wifi-config
#!/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.
=====================================================================
@forslund
forslund / changing_confidence.py
Created May 30, 2018
Demonstration of changing confidence when adding extra regexes
View changing_confidence.py
from adapt.intent import IntentBuilder
from adapt.engine import IntentDeterminationEngine
def check_for_location(intent):
if 'Location' in intent:
print('Location: {}'.format(intent['Location']))
else:
print('Location: Not found')
@forslund
forslund / adapt_optionally_regex.py
Created May 30, 2018
Failing optionally adapt test case
View adapt_optionally_regex.py
from adapt.intent import IntentBuilder
from adapt.engine import IntentDeterminationEngine
def check_for_location(intent):
if 'Location' in intent:
print('Location: {}'.format(intent['Location']))
else:
print('Location: Not found')
View find_mycroft.py
from zeroconf import ServiceBrowser, Zeroconf
class MycroftListener(object):
def __init__(self):
self.devices = {}
def remove_service(self, zeroconf, type, name):
print("Service %s removed" % (name,))
self.devices.pop(name)
@forslund
forslund / basic_install.sh
Last active Sep 21, 2017
Setup mycroft SD card
View basic_install.sh
#!/usr/bin/env bash
sudo apt-get update
sudo apt-get install apt-transport-https -y
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F3B1AA8B
sudo bash -c 'echo "deb http://repo.mycroft.ai/repos/apt/debian debian main" > /etc/apt/sources.list.d/repo.mycroft.ai.list'
sudo apt-get update
sudo apt-get install mycroft-core -y
# Vim for the people!
sudo apt-get install vim -y
View mimic prereqs
sudo apt-get install -y git gcc make pkg-config automake libtool libasound2-dev unzip
You can’t perform that action at this time.