Skip to content

Instantly share code, notes, and snippets.

arjunmenon / Lightweight Speech to Text with PocketSphinx.ipynb Simple, fast, reasonably accurate speech-to-text processing for audio recordings of speech.
View Lightweight Speech to Text with PocketSphinx.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
arjunmenon / codepenclone.html
Created Aug 14, 2018 — forked from pachacamac/codepenclone.html
Mini Codepen Clone with sharing function
View codepenclone.html
<!DOCTYPE html>
<meta charset="utf-8" />
body,textarea,iframe{ margin:0; box-sizing:border-box; }
textarea,iframe { width:100%; height:50vh; float:left; }
textarea { color:#eee; background:#111; font-family:monospace; font-size:11pt; line-height:1.4; width:33.33%; }
#shareBtn { position:absolute; bottom:0; left:0; }

Run test_glade.rb
Run basic.rb

arjunmenon / create_xml.rb
Created Jun 12, 2018 — forked from kimjoar/create_xml.rb
Simple Ruby DSL to generate XML
View create_xml.rb
require './xmldsl'
Twitter = :name, :avatar, :text
twitters = []
5.times { twitters <<"Jonas", "/profile.png", "Hello World!") }
xml = XML.generate do
html do
body do
twitters.each do |tw|
arjunmenon / Hash.from_xml
Created Jun 6, 2018 — forked from huy/Hash.from_xml
Convert xml to hash using Nokogiri
View Hash.from_xml
# USAGE: Hash.from_xml(YOUR_XML_STRING)require 'rubygems'
require 'nokogiri'
# modified from
class Hash
class << self
def from_xml(xml_io)
result = Nokogiri::XML(xml_io)
arjunmenon / vin_to_gif.rb
Created Apr 10, 2018 — forked from seyhunak/vin_to_gif.rb
Vine MP4 to GIF Converting using Ruby
View vin_to_gif.rb
# space150 vine-to-GIF
# given a uri, downloads the MP4 and creates an image sequence / GIF from it
# requires ruby, ffmpeg, and imagemagick
require 'open-uri'
require 'nokogiri'
id = ARGV[0]
# try to convert from URL to id.
arjunmenon / python_server
Created Jan 1, 2018
Python server monitring any HTTP requests
View python_server
#!/usr/bin/env python
# Read requests from HTTP methods GET, POST, PUT, DELETE, NOTIFY or any other custom method
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from optparse import OptionParser
class RequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
View index.js
var Client = require('./upnp_client.js')
var client = new Client('');
// Get the device description
client.getDeviceDescription(function(err, description) {
if(err) throw err;
console.log("starting device description module")
arjunmenon / strip HTML tags
Created Oct 16, 2017 — forked from awesome/strip HTML tags
ruby strip HTML tags
View strip HTML tags
# copied from (thanks!):
str = <<HTML_TEXT
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
<h1>Application error</h1>
<p>Change this error message for exceptions thrown outside of an action (like
in Dispatcher setups or broken Ruby code) in public/500.html</p>
arjunmenon / Ruby
Last active Nov 14, 2017
Practical Ruby snippets
View Ruby
  1. Split sentence preserve punctuation

Use scan (throw strip in there to get rid of trailing spaces).

s = "I am a lion. Hear me roar! Where is my cub? Never mind, found him."
s.scan(/[^\.!?]+[\.!?]/).map(&:strip) # => ["I am a lion.", "Hear me roar!", "Where is my cub?", "Never mind, found him."]

  1. Simple detect puncutation in string