Skip to content

Instantly share code, notes, and snippets.

@d2rk
d2rk / .emacs
Last active August 29, 2015 14:02
Emacs config
;; -*- coding: utf-8; mode: emacs-lisp; -*-
;;
;; Copyright (c) 2011-2014 Oleksandr Sviridenko
;; Show line number.
(setq linum-mode 1)
;; Help fill-paragraph.
(setq-default fill-column 80)
;; Show column number.
@d2rk
d2rk / pi_speech_recognition.sh
Created February 23, 2014 12:16
Speech recognition with Raspberry Pi and Google Speech API
#!/bin/bash
echo "Recording, press ctrl+c to stop..."
arecord -D "plughw:1,0" -q -f cd -t wav | ffmpeg -loglevel panic -y -i - -ar 16000 -acodec flac speech.flac > /dev/null 2>&1
echo "Processing..."
wget -q -U "Mozilla/5.0" --post-file speech.flac --header "Content-Type: audio/x-flac; rate=16000" -O - "http://www.google.com/speech-api/v1/recognize?lang=en-us&client=chromium" | cut -d\" -f12 > speech.txt
echo -n "You said: "
cat speech.txt
#!/usr/bin/env python
from __future__ import print_function
import pygame
import serial
import sys
SABERTOOTH_PORT_NAME = '/dev/ttyUSB0'
SABERTOOTH_PORT_BAUDRATE = 9600