This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib2 | |
import json | |
curr_from = "JPY" | |
curr_to = "INR" | |
curr_input = 1 | |
curr_pair = curr_from + "_" + curr_to | |
api_url = "https://free.currencyconverterapi.com/api/v5/convert?q={0}&compact=ultra".format(curr_pair) | |
jsonurl = urllib2.urlopen(api_url) | |
rate_json = json.loads(jsonurl.read()) | |
rate = curr_input * float(rate_json[curr_pair]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
################################################################## | |
# | |
# Purpose: | |
# | |
# Script checks to see if WiFi has a network IP and if not | |
# restart WiFi | |
# | |
# Uses a lock file which prevents the script from running more | |
# than one at a time. If lockfile is old, it removes it |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2 | |
# -*- coding: utf-8-*- | |
# Copyright 2016 g10dras. | |
__author__ = 'g10dras' | |
import sys | |
import yaml | |
from PyQt4 import QtGui, QtCore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pyaudio | |
po = pyaudio.PyAudio() | |
for index in range(po.get_device_count()): | |
desc = po.get_device_info_by_index(index) | |
print ("DEVICE: {0} \t INDEX: {1} \t RATE: {2}".format(desc["name"],index,int(desc["defaultSampleRate"]))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pcm.usb | |
{ | |
type hw | |
card Device | |
} | |
pcm.!default | |
{ | |
type asym | |
playback.pcm | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lsusb | |
lsusb -v -d 1b3f:2007 | grep tSamFreq | |
cat /proc/asound/cards | |
cat /proc/asound/modules | |
cat ~/.asoundrc | |
cat /etc/asound.conf | |
alsamixer -c 0 | |
alsamixer -c 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
hardware="plughw:0,0" | |
duration="4" | |
lang="en" | |
client="Mozilla/5.0" | |
apikey="XXxxXXxXxXxxXX_8XxxXXXXxxxxx_X8XXxxxxxX" | |
arecord -D $hardware -f S16_LE -t wav -d $duration -r 16000 | flac - -f --best --sample-rate 16000 -o /tmp/out.flac 1>/tmp/voice.log 2>/tmp/voice.log; curl -X POST --data-binary @/tmp/out.flac --user-agent 'Mozilla/5.0' --header 'Content-Type: audio/x-flac; rate=16000;' "https://www.google.com/speech-api/v2/recognize?output=json&lang=$lang&pfilter=2&maxresults=6&key=$apikey&client=$client" | sed -e 's/[{}]/''/g' | awk -F":" '{print $4}' | awk -F"," '{print $1}' | tr -d '\n' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Extract alsa hardware device descriptions/ids from arecord/aplay""" | |
import subprocess, re, logging, json | |
log = logging.getLogger( __name__ ) | |
CARD_MATCH = re.compile(r'card (?P<card>\d+)[:].*?[[](?P<description>.*?)[]], device (?P<device>\d+)[:].*?[[](?P<device_description>.*?)[]]' ) | |
def get_inputs( ): | |
"""Get alsa inputs (relies on having arecord present)""" | |
output = subprocess.check_output( ['arecord','-l'] ) | |
cards = [line for line in output.splitlines() if line.startswith( 'card ' )] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from pocketsphinx.pocketsphinx import * | |
from sphinxbase.sphinxbase import * | |
import os | |
import pyaudio | |
import wave | |
import audioop | |
from collections import deque |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from twilio.rest import TwilioRestClient | |
accountSID = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx' | |
authToken = 'xxxxxxxxxxxxxxxxxxxxxxxx' | |
myTwilioNumber = '+xxxxxxxxxxxxxxxxxx' | |
myCellPhone = '+xxxxxxxxxxxx' | |
def text(message): | |
twilioCli = TwilioRestClient(accountSID, authToken) |
NewerOlder