Skip to content

Instantly share code, notes, and snippets.

View forslund's full-sized avatar
🌙

Åke forslund

🌙
View GitHub Profile
@forslund
forslund / gist:6cf3e18ebd7f16952d3a
Last active August 29, 2015 14:21
simple c64 program
#include <stdio.h>
#include <string.h>
#define MEM_CENTER_COLOR (char *)0xd021
#define MEM_BORDER_COLOR (char *)0xd020
void set_background(char center_color, char border_color)
{
char *border, *center;
border = MEM_CENTER_COLOR;
@forslund
forslund / czed_cgeo
Created July 7, 2012 09:39
android log for cgeo issue #1607
D/dalvikvm(21135): GC freed 6154 objects / 390440 bytes in 99ms
I/ActivityManager( 1191): Starting activity: Intent { cmp=cgeo.geocaching/.CacheDetailActivity (has extras) }
E/Position(20851): Unknown network type, aborting
D/dalvikvm(21135): GC freed 13080 objects / 834816 bytes in 118ms
E/SkLayout_wtle(21135): failed to compose after ellipsize error:106
E/SkLayout_wtle(21135): ellipsis failed line number does not match 1 0
E/SkLayout_wtle(21135): failed to compose after ellipsize error:106
E/SkLayout_wtle(21135): ellipsis failed line number does not match 1 0
E/SkLayout_wtle(21135): failed to compose after ellipsize error:106
E/SkLayout_wtle(21135): ellipsis failed line number does not match 1 0
from mycroft.skills.core import MycroftSkill
from mycroft.messagebus.client.ws import WebsocketClient
import sys
import gc
class TestSkill(MycroftSkill):
def __init__(self):
super(TestSkill, self).__init__()
self._dir = './'
sudo apt-get install -y git gcc make pkg-config automake libtool libasound2-dev unzip
@forslund
forslund / basic_install.sh
Last active September 21, 2017 06:30
Setup mycroft SD card
#!/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
@forslund
forslund / gist:9d8805fd7adb9e74ec3ea321e1676a21
Last active November 17, 2017 15:18
Simple program to convert png to mycroft display images
import sys
from PIL import Image
def mouth_display_png(image_absolute_path, threshold=70,
invert=False, x=0, y=0):
"""Converts a png image into the appropriate encoding for the
Arduino Mark I enclosure.
NOTE: extract this out of api.py when re structuing the
enclosure folder
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 / adapt_optionally_regex.py
Created May 30, 2018 06:15
Failing optionally adapt test case
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 / changing_confidence.py
Created May 30, 2018 13:38
Demonstration of changing confidence when adding extra regexes
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')
#!/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.
=====================================================================