Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python
# Copywritght 2013-Present, Scott Cagno (BSD LICENSE)
# basic python program for linux to enable speech to text
# this is the first hack, could use more improvement
import sys, alsaaudio, wave, numpy, os, threading, time, commands, json
arl = []
run = 1
@scottcagno
scottcagno / googapi.sh
Created June 17, 2013 22:49
Simple Google Speech Recognition API Hook. ----- requires ------- sudo apt-get install sox, curl
#!/bin/bash
sox -q -r 16000 -b 16 -c 1 -d a.flac silence 1 0.3 1% 1 0.5 1% 2>/dev/null
curl -s --data-binary @a.flac --header 'Content-Type: audio/x-flac; rate=16000' 'https://www.google.com/speech-api/v1/recognize?client=chromium&lang="en-us"' | cut -d"," -f3 | sed 's/^.*utterance\":\"\(.*\)\"$/\1/g'
rm a.flac
@scottcagno
scottcagno / vim_plugins
Created July 5, 2013 06:50
vim snippet and autocomplete bash bootstrapper
#!/bin/bash
# install requirements if need be
if [ ! -x git ]; then
sudo apt-get install git
fi
# grab, install, and stage plugin for vim snippets, aka: snipmate
cd ~/Downloads
git clone https://github.com/msanders/snipmate.vim
set tabstop=4
set shiftwidth=4
set expandtab
set number
syntax on
set backspace=2
set nocompatible
#!/usr/bin/env python
# Copyright (c) 2008 Carnegie Mellon University.
#
# You may modify and redistribute this file under the same terms as
# the CMU Sphinx system. See
# http://cmusphinx.sourceforge.net/html/LICENSE for more information.
import pygtk
pygtk.require('2.0')
@scottcagno
scottcagno / bencher.go
Created November 12, 2013 21:24
tcp benchmarker
// *
// * Copyright 2013, Scott Cagno, All rights reserved.
// * BSD Licensed - sites.google.com/site/bsdc3license
// * NARDb :: Not A Relational Database
// *
package main
import (
"encoding/json"
@scottcagno
scottcagno / tar_example.go
Created November 14, 2013 07:35
read and write tar files/archives
package main
import (
"archive/tar"
"encoding/json"
"fmt"
"io"
"log"
"os"
)
@scottcagno
scottcagno / btree.py
Created December 9, 2013 23:31 — forked from teepark/btree.py
import bisect
import itertools
import operator
class _BNode(object):
__slots__ = ["tree", "contents", "children"]
def __init__(self, tree, contents=None, children=None):
self.tree = tree
@scottcagno
scottcagno / crawl.sh
Last active August 29, 2015 13:57
simple curl wrapper to aid in web testing
#!/bin/bash
# File: crawl.sh
# Desc: Package designed to provide an API to help automate web testing
# Dependencies: curl, getopts
# Copyright 2014, Scott Cagno, All rights reserved.
# usage function
function usage() {
echo -e "usage: $0 <opts> -h [host-uri]"
echo -e " opts:"
@scottcagno
scottcagno / install_spring.sh
Created March 12, 2014 17:54
spring source installer
#!/bin/bash
sudo echo "Need to be root, please authenticate..."
echo "Downloading spring source..."
curl -o sts.tar.gz http://download.springsource.com/release/STS/3.4.0/dist/e4.3/spring-tool-suite-3.4.0.RELEASE-e4.3.1-linux-gtk-x86_64.tar.gz
echo "Extracting..."
tar -xf sts*.tar.gz
echo "Staging..."
sudo mv springsource /opt
echo "Creating symbolic links..."
sudo ln -s /opt/springsource/sts*/STS /usr/local/bin/sts