Skip to content

Instantly share code, notes, and snippets.

View krisgesling's full-sized avatar

Kris Gesling krisgesling

  • Mycroft AI
  • Darwin, Australia
View GitHub Profile
@krisgesling
krisgesling / get_video_list.py
Created December 20, 2023 04:25
Fetch a list of Youtube videos for a given channel
import csv
import requests
def get_videos(channel_id, api_key):
# Construct the API request
# url = f"https://www.youtube.com/t/videos?part=snippet&q={channel_url}&type=video"
url = f"https://www.googleapis.com/youtube/v3/search?key={api_key}&channelId={channel_id}&part=snippet,id&order=date&maxResults=50"
# Send the API request and get the response
response = requests.get(url)
@krisgesling
krisgesling / core-vocab-analysis.sh
Created January 24, 2022 01:57
Simple script to count word frequency and line length for a given set of text files.
#!/bin/bash
cd $1
# CONFIG VARIABLES
ignoreChars=',.?!'
for filename in ./*.txt; do
outputFile=$(basename $filename .txt)'_'"$(date '+%Y-%m-%d-%H:%M:%S')"'.txt'
touch $outputFile
echo '****************************' >> $outputFile
@krisgesling
krisgesling / mark-ii-mycroft-container
Created April 1, 2021 03:56
Mark II mycroft container build script
FROM alpine as qemu
RUN if [ -n "aarch64" ]; then \
wget -O /qemu-aarch64-static https://github.com/multiarch/qemu-user-static/releases/download/v5.1.0-5/qemu-aarch64-static; \
else \
echo '#!/bin/sh\n\ntrue' > /qemu-aarch64-static; \
fi; \
chmod a+x /qemu-aarch64-static
FROM arm64v8/ubuntu:20.04 as builder
@krisgesling
krisgesling / build.sh
Created February 1, 2021 23:50 — forked from forslund/build.sh
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
@krisgesling
krisgesling / mv-bulk.sh
Created June 2, 2020 23:42
Move a defined proportion of files from one folder to another. Particularly useful for directories with large numbers of files.
#!/bin/bash
DIR_FROM=$1
DIR_TO=$2
PERCENTAGE=$3
COUNTER=0
for file in $DIR_FROM*; do
val=$RANDOM
# Max possible value is 32760
#!/bin/bash
sudo apt-get install git
git clone https://github.com/MycroftAI/mycroft-core.git
cd mycroft-core
bash dev_setup.sh -sm
./start-mycroft.sh debug
@krisgesling
krisgesling / mycroft.conf_CA0110-IBG_Analog
Created September 11, 2019 04:52
Mycroft.conf for HDA Creative: CA0110-IBG Analog
{
"max_allowed_core_version": 19.2,
"listener": {
"device_name": "HDA Creative: CA0110-IBG Analog"
}
}
@krisgesling
krisgesling / mycroft.conf_ALC887-VD
Last active September 11, 2019 04:51
Mycroft Config for HDA Intel PCH: ALC887-VD Analog
{
"max_allowed_core_version": 19.2,
"listener": {
"device_name": "HDA Intel PCH: ALC887-VD Analog"
}
}
{
"name": "Telegram Skill",
"skillMetadata": {
"sections": [
{
"name": "Telegram Bot",
"fields": [
{
"type": "label",
"value": "",
import csv
import sre_yield
from os.path import join
skill_path = '/opt/mycroft/skills/skill-date-time.ndato'
output_file = './tests_to_create.csv'
intent_handler = 'handle_query_current_time_adapt'
expected_dialog = "time.future"
offset = 8
location = 'London'