Google

Campaign0

Friday, May 22, 2015

Interactive Editor -- vim in ruby

http://vimcasts.org/episodes/running-vim-within-irb/

Monday, January 26, 2015

gwan web application server

http://gwan.com/

G-WAN runs C, C# or Java with less CPU and less RAM while handling more requests than other servers. Other languages (Go, PHP, Python, Ruby, JS...) benefit from G-WAN's multicore architecture.

Tuesday, August 31, 2010

Mongoose webserver - single file embedable webserver coded in C

From the website http://code.google.com/p/mongoose/

Mongoose is an easy to use web server. It can be embedded into existing application to provide a web interface to it.

Mongoose web server executable is self-sufficient, it does not depend on anything to start serving requests. If it is copied to any directory and executed, it starts to serve that directory on port 8080 (so to access files, go to http://localhost:8080). If some additional config is required - for example, different listening port or IP-based access control, then a mongoose.conf file with respective options (see example) can be created in the same directory where executable lives. This makes Mongoose perfect for all sorts of demos, quick tests, file sharing, and Web programming.

Saturday, February 28, 2009

Or, Let Picard ID Your Music

If you'd prefer a bit more control over your music id'ing than the previously posted ruby script, then Picard should fit the bill. I'm using it in conjunction with the noted script.

http://musicbrainz.org/doc/PicardTagger

From the site:

Picard is the next generation MusicBrainz tagging application. This new tagging concept is album oriented, as opposed to track/file oriented like the ClassicTagger was. Picard is written in Python, which is a cross-platform language, and makes use of cross-platform libraries - this allows the same code to run both on Windows, Linux and Mac OS X.

Let Ruby ID Your Music

Tender Lovemaking » Blog Archive » Identifying unknown music with Ruby

A quick intro noted above from the author of the earworm gem. A really cool piece of work for identifying music files.

Here's how I am using it -- note that I'm also using rbrainz, another really neat piece of code.. This code needs to be a bit neater/more functional, but it was a quick solution to a bunch of mp3's pulled down from spinner.com's and daytrotter.com's mp3 of the day pages.

What it does:
Walks a file hierarchy finding *.mp3/*.MP3 files.
Renames the file based on the id3 tags in the file.
Relocates the file into my Music directory in the proper file hierarchy based on the id3 tags.
If it can't id the file via id3 tags, it tries to id the file via rbrainz, and update the tags
If it can, it relocates the file appropriately
If it can't it dumps the file into Music/undertermined -- I can come back next month and try the id again.


require 'rubygems'
require 'id3lib'
require 'earworm'
require 'rbrainz'
include MusicBrainz

class String
def alnum_ws_sanitize()
self.gsub!(/[^\/[:alnum:]\s]/, '')
end
end

def printAndDescend(pattern)
#we keep track of the directories, to be used in the second, recursive part of this function
directories=[]
Dir['*'].sort.each do |name|
if File.file?(name) and name[pattern]
# Load a tag from a file
tag = ID3Lib::Tag.new(File.expand_path(name))
#p tag
musicdir="/home/rthompso/Music/"
if tag.title and tag.album and tag.artist
dirpath = musicdir + tag.artist.strip + "/" + tag.album.strip
dirpath.alnum_ws_sanitize

puts dirpath
if !File.directory?(dirpath)
FileUtils.mkdir_p(dirpath)
end

# if !File.directory?(tag.album)
# FileUtils.mkdir_p tag.album
# end

tag.title.alnum_ws_sanitize
if !File.exists?(tag.title)
dest = dirpath.strip + "/" + tag.title.strip.tr('/()','-') + ".mp3"
FileUtils.mv(File.expand_path(name), dest)
end
puts "Title: " + tag.title
puts "Album: " + tag.album
puts "Artist: " + tag.artist
else
# puts "Title: " + tag.title
# puts "Album: " + tag.album
# puts "Artist: " + tag.artist
puts File.expand_path(name)
ew = Earworm::Client.new('9fd161da6c15d840fc25f0df0fac7b1f')
begin
info = ew.identify(:file => File.expand_path(name))
rescue => e
FileUtils.mv(File.expand_path(name), "/home/rthompso/Music/undetermined")
puts "ew.identify failed"
puts(File.expand_path(name))
next
end
q = MusicBrainz::Webservice::Query.new
results = q.get_tracks(Webservice::TrackFilter.new(:puid => info.puid_list))
if results.count
begin
tag.title = results[0].entity.title
tag.album = results[0].entity.releases.entries
tag.artist = results[0].entity.artist
tag.update!
#puts results[0].score

puts results[0].entity.title
puts results[0].entity.releases.entries
puts results[0].entity.artist
puts "going to set tags now"
rescue
FileUtils.mv(File.expand_path(name), "/home/rthompso/Music/undetermined")
puts "musicbrainz failed"
puts(File.expand_path(name))
end
else
FileUtils.mv(File.expand_path(name), "/home/rthompso/Music/undetermined")
puts(File.expand_path(name))

end
end

elsif File.directory?(name)
directories << name
end
end
directories.each do |name|
#don't descend into . or .. on linux
Dir.chdir(name){printAndDescend(pattern)} if !Dir.pwd[File.expand_path(name)]
end
end

#print all ruby files
printAndDescend(/.+\.mp3$/)
printAndDescend(/.+\.MP3$/)

Saturday, December 6, 2008

Evolution + clamav + ruby

Quite a while ago I tied Evolution to clamav via ruby as an anti-virus measure ( I don't recall, but I most likely based this off of something similar, but not using ruby, that I found via Google ). I recently passed this setup on via the Evolution mailing list in reference to a posted request for examples. After a bit of back and forth, it appears to be working for the requestor. At his suggestion, I'm posting the configuration here also. The filter configuration is shown in the image, and the actual script is listed after. You'll want to make whatever minor adjustments necessary for it to work in your environment and you'll probably want to comment out the segments associated with creating the logfiles -- they will end up eating a lot of disk space( comment out the lines referencing fp and Time).

Click the image to see it clearly.


The script file -- rubyclamav.rb

#!/usr/bin/ruby
#
require 'socket'
fp = File.open("/var/log/rubyclamav/rubyoutclam_#{Process.pid}.log", "a")
START_TIME=Time.now
sendSock = UNIXSocket.open('/var/run/clamav/clamd.sock')
#sendSock = UNIXSocket.open('/var/run/clamav/clamd.ctl')
sendSock.puts("STREAM")
retStr = sendSock.gets
tag, val = retStr.split
sendSock1 = TCPSocket.open('localhost',"#{val}")
#res = $stdin.read
sendSock1.write($stdin.read)
sendSock1.close
retStr = sendSock.gets
pt = Time.now - START_TIME
#puts "#{retStr}"
#fp.write("#{res}\n")
fp.write("#{retStr}\n")
fp.write("ProcessTime = #{pt}\n")
fp.close
if retStr.match("FOUND") then
system("zenity --warning --title=\"Evolution: Virus detected\" --text=\"#{retStr}\" &")
exit 1
else
exit 0
end

Tuesday, April 22, 2008

Cheat Sheet 3

pthread tutorial

A starter tutorial for pthread threaded programming.

Cheat Sheets 2

Cheat Sheets 1

Developer cheat sheets. Web, DB, Language, etc

Looking for UPC database cross reference?

Look no further. Check out the Internet UPC Database

Aptera - $30K hybrid claims +100MPG

Wouldn't it be cool to own one of these...
aptera

Sunday, April 6, 2008

Nathan Asher & The Infantry

A very cool local band. Take a listen.

The Baen Free Library

From the website...
"Baen Books is now making available — for free — a number of its titles in electronic format. We're calling it the Baen Free Library. Anyone who wishes can read these titles online — no conditions, no strings attached. (Later we may ask for an extremely simple, name & email only, registration. ) Or, if you prefer, you can download the books in one of several formats. Again, with no conditions or strings attached. (URLs to sites which offer the readers for these format are also listed. )"

Free Online Linux Books

A listing of free linux related books available online...

Linux Device Drivers, Third Edition

"This is the web site for the Third Edition of Linux Device Drivers,
by Jonathan Corbet, Alessandro Rubini, and Greg Kroah-Hartman. For the
moment, only the finished PDF files are available..."

VIM Color Scheme Test

The vim colorscheme test pages. An exceptional resource for vim users.

The example C pages...

Asterisk - open source PBX

Asterisk and Digium provide a great PBX framework.

eXtended Server Pages (XSP/XSPD) -- C/C++

eXtended Server Pages (XSP/XSPD)
High Performance Web Application Server XSP/XSPD for C/C++, Java and Shell-Scripts

Saturday, April 5, 2008

CPPSERV a web application server -- C++

"CPPSERV is a web application server that provides Servlet-like API and JSP-like functionality to C++ programmers. It consists of stand-alone daemon, listening on TCP socket for requests from web server, and web server module. Currently apache-2.0.x and ligttpd are supported."

Wednesday, March 19, 2008

del.icio.us bulk updater

re-mark -- A great tool. I had 700+ bookmarks that were not shared, using this tool I was able to share all of them in batches of 100.

Linux Kernel module example

Simple easy kernel module example.

Ruport - ruby reports

Need a neat reporting framework, try Ruport.

GnomeFiles

Large repository of Gnome applications. Search and broken out by group.

bogofilter spam filter

I use bogofilter for my evolution mail filter. It works great. If you need a good spam filter give it a whirl.

Linux on a USB drive

Multiple distros available ( including many not listed on this site - just google ).
Grab your USB linux and go.

130 MPG 2 passenger vehicle

If only it were available here and I had $30K
aptera

Sunday, February 24, 2008

Scientific American ( www.sciam.com) - Great magazine

Scientific American is a great read. Lots of great articles and information. Subscribe or give it as a gift.

Cygwin - The best windows application ever


Cygwin is a Linux-like environment for Windows.

Required to use Windows? Need the functionality of *NIX command line tools? Cygwin is the answer. Need a real terminal program -- download rxvt.

Tuesday, February 19, 2008

Cool mandelbrots

Buddhabrot

some cool mandlebrot images.

Monday, February 18, 2008

$115 gets you your own hydrogen powered car

Horizon Fuel Cell Technologies has some cool fuel cell powered cars.

Welcome to 7-zip

7-zip is the file archiver ( compress/decompress ) that I use on windows. Free, and works very well.

Thursday, February 14, 2008

Zim - a desktop wiki and outliner

I like and use Tomboy, but for some things Zim (hierarchical, grouping, etc) seems a better fit. From the website "Zim is a WYSIWYG text editor written in Gtk2-Perl which aims to bring the concept of a wiki to your desktop." I'm using it at work, and I installed it on my son's desktop for school related note taking.

Wednesday, February 13, 2008

Looking for a low cost DIY music player

I've been looking off and on for years for a DIY music player that would allow me to build one 'as good as or better than' those mass produced at an 'extremely reasonable' price. And I'm still looking. :) If anyone has any pointers, please post them.

Tuesday, February 5, 2008

streamtuner -- Find the music you want

a great app for anyone that likes music. allows browsing and searching of multiple online music sources.
streamtuner


Powered by ScribeFire.

Saturday, January 26, 2008

jVi - vi editor plugin for NetBeans

If you use vi[m] you'll want this plugin. Don't know what vim is? See vim.org for the details. In short, once you get past the learning curve, vim is one of the greatest programming editors around.


Powered by ScribeFire.

88.1 WKNC FM Radio -- NC State University Radio -- Tired of the same songs over and over?

When you get sick of hearing the same tunes over and over on the radio, give WKNC a whirl. They have formats for everyone. It really is an exceptional station. Requests taken.

From the website...
"88.1 WKNC is the student-run non-commercial radio of North Carolina State University. We pride ourselves on our unique and adventurous programming and have been named "Best in the Triangle" by the Independent Weekly four years running. Boasting 25,000 watts, WKNC can be heard throughout the Triangle and far beyond via our web stream. Our mission is to provide N.C. State students with the practical knowledge needed for a career in the broadcast industry."

Powered by ScribeFire.