This file contains hidden or 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
| (defn truncate-safely-to [s bytelimit] | |
| "Truncate a UTF-8 string to the longest valid UTF-8 string less than bytelimit bytes" | |
| (if (< bytelimit 1) "" ; empty string | |
| (let [utf8 (.getBytes s "UTF-8") | |
| eos (- bytelimit 1) | |
| idx (if (<= (alength utf8) bytelimit) | |
| bytelimit | |
| (if (= 0 (bit-and (aget utf8 eos) 0x80)) | |
| eos | |
| (first ;; get the character |
This file contains hidden or 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 ruby | |
| require 'nokogiri' | |
| require 'open3' | |
| Track = Struct.new(:fullpath, :duration, :seqnum) | |
| tracks = Dir.glob("**/*.mp4").map.with_index {|file, i| | |
| output = Open3.capture2e("/usr/bin/tagreader", file) {|out| out} | |
| if output[1].to_i != 0 # Successful return status? |
This file contains hidden or 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/sh | |
| outfile=`date +"%Y-%m-%d-%H-%M-%S"` | |
| arecord -t wav -f S16_LE -c 1 -r 22050 > ~/training/$outfile.wav |
This file contains hidden or 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 ruby | |
| require 'time' | |
| class Time | |
| def convert_zone(to_zone) | |
| original_zone = ENV["TZ"] | |
| utc_time = dup.gmtime | |
| ENV["TZ"] = to_zone | |
| to_zone_time = utc_time.localtime |
This file contains hidden or 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
| require 'date' | |
| class Date | |
| def human_string() | |
| d = self | |
| today = Date.today | |
| days_apart = (today - d).to_i | |
| # Figure out the appropriate ordinal suffix for the n"th" | |
| if d.mday != 11 and d.mday.to_s =~ /1$/ |
This file contains hidden or 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
| <html> | |
| <head> | |
| <title>JQuery tests</title> | |
| <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script> | |
| </head> | |
| <body> | |
| <h1>JQuery tests</h1> | |
| <form> |