Skip to content

Instantly share code, notes, and snippets.

View tjoen's full-sized avatar

Theun Kohlbeck tjoen

View GitHub Profile
#!/bin/sh
# put this file in /etc/network/if-up.d/
if iwconfig wlp4s0 | grep -c "ESSID:\"WIFIonICE\""
then
curl -s "https://www.ombord.info/hotspot/hotspot.cgi?connect=&method=login&realm=db_advanced_wifi"
fi
@tjoen
tjoen / import_facegen_tri.py
Created April 17, 2018 16:07 — forked from himika/import_facegen_tri.py
.tri file importer for Blender 2.49b 要 pyffi 2.1.10
#!BPY
"""
Name: 'FaceGen TRI (.tri)...'
Blender: 249
Group: 'Import'
Tooltip: 'Load a FaceGen TRI file.'
"""
__author__= "himika"
@tjoen
tjoen / stt_tts_nl.py
Created March 6, 2018 17:11
Dutch Google stt and tts in python
#!/usr/bin/env python
#-*- coding: utf-8 -*-
from gtts import gTTS
import os
import speech_recognition as sr
import tempfile
import time
import pyaudio
import wave
@tjoen
tjoen / plot_wav.py
Created March 2, 2018 16:17 — forked from leouieda/plot_wav.py
Python code to plot a .wav file
# Load the required libraries:
# * scipy
# * numpy
# * matplotlib
from scipy.io import wavfile
from matplotlib import pyplot as plt
import numpy as np
# Load the data and calculate the time of each sample
samplerate, data = wavfile.read('Clapping.wav')
@tjoen
tjoen / speechclient.py
Created January 31, 2018 13:32
Mycroft test script to use animated character, needs 7 gifs with correct mouthshapes
import websocket
import time
import threading
import json
import pyglet
# Create and open a window
window = pyglet.window.Window(257, 257)
# Load sprites
@tjoen
tjoen / streamchromecast.py
Created January 23, 2018 17:29
chromecast.sh script for mycroft use
from __future__ import print_function, unicode_literals
import os
import os.path
import time
from threading import Thread
from urllib import quote
import random
from SimpleHTTPServer import SimpleHTTPRequestHandler
from SocketServer import TCPServer
import json
@tjoen
tjoen / googleimgvid.py
Created December 12, 2017 18:06
Handy functions to get links to images and videos
import json
from bs4 import BeautifulSoup
import urllib2
request_headers = {
"Accept-Language": "en-US,en;q=0.5",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Referer": "http://thewebsite.com",
import json
from bs4 import BeautifulSoup
import urllib2
request_headers = {
"Accept-Language": "en-US,en;q=0.5",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Referer": "http://thewebsite.com",
@tjoen
tjoen / imgsrch.py
Last active December 12, 2017 16:20
google image search
import json
from bs4 import BeautifulSoup
import urllib2
request_headers = {
"Accept-Language": "en-US,en;q=0.5",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Referer": "http://thewebsite.com",
"Connection": "keep-alive"
@tjoen
tjoen / button.py
Last active October 21, 2018 08:30
button.py
# Mycroft quick and dirty led and button tester
#
# Put mbus.py, button.py and light.py in /home/pi
# Run python lights.py in another terminal
# or better: add it to your autorun.sh like this:
# python /home/pi/lights.py </dev/null &>/dev/null &
# just before:
# else
# # running from a SSH session
# echo "Remote session"