Implementing linux/unix’s “touch” command on windows.

Purpose of the touch command: create a new file or ‘touch’ some file to update its timestamp; naturally, touching a file that isn’t there will create a new file with a current time and date timestamp.

The binary file is included at the end of this post. However, if you want to “compile” this on your own, you’ll need:

  1. Ruby 1.9.3 (
  2. Ruby 1.9.3 devkit ( — follow the directions at to add the devkit, just in case.
  3. The ocra rubygem (in command prompt [cmd.exe] — type “gem install ocra” without the quotes

Then, with the source code saved as something like touch.rb, do:

You’ll then have touch.exe, which you can place in your C:/windows/system32 folder or /path_to_ruby/bin/ folder, and can use it as so:

Touch.zipSource code and binary.


Quick Coding: dealing with quirks in Sinatra + Thin + Windows 8.1 (part 2) — Hacking runner.rb

It seems that the option for -C is set to not be available if you’re under Windows. Ultimately, I ended up creating a quick hack, realizing that if you execute:

Then, thin will write a default configuration file with a bunch of options which are only available under Linux, like daemonize: true. having daemonize set to true in a config.yaml file while under Windows will result in an error raised by Ruby (no daemonizing supported).

It’s simple enough after changing runner.rb around, to allow -C to be used in the context of starting a server.

runner.rb is in: C:\Programming\Ruby200-x64\lib\ruby\gems\2.0.0\gems\thin-1.6.2\lib\thin

On line 99-ish, make a simple edit, moving the entire line:

out of the “unless” statement; the resulting code looks like this:

Now you can perform command line arguments with statements such as:

if you generate a config.yml file first with:

be sure to set:

In your config.yml file–or remove it altogether.

I’m assuming the developer was thinking that nobody would be using thin on Windows, god forbid.


In the documentation of thin’s basic usage (, you can use thin -C config.yml to deal with configuring a thin server.




This has puzzled me for centuries; I guess the lesson learnt is that software development on Windows is not always the greatest thing.

TODO: monkey patch runner.rb

Quick Coding: dealing with quirks in Sinatra + Thin + Windows 8.1 (part 1)

This is mostly to document an ongoing issue I’ve been going with while tinkering around with Sinatra in Windows 8.1, sadly.



A while back I never documented issues passing through arguments with Sinatra while using it with a combination of, thin, and rackup on the command line. Well, I finally found a one-liner that makes life with sinatra/windows 8.1 SLIGHTLY easier… First though:

2014-09-21 22_19_39-Add New Post ‹ TheInterface.rb — WordPress - Pale Moon

All I really need is:

“-e development” (etc)  sets your application to run in development or production (forgot what it defaults to), but you have to configure a few things depending on what you want to do.

Then somewhere within my app class:

In this case, I don’t have Sinatra::Reloader registered while in production mode, since I want Sinatra to be a bit more persistent instead of reloading per page request.

But the magic piece of code is

You could pretty much name your environment(s) anything.


More to come.


Update: Now i’m investigating something like this:


Well, my assumptions after using thin from the command line for a while is true: the argument to parse a configuration file (-C) doesn’t seem to be available on Windows 8.1 or at least this version of thin… That kinda sucks; I may poke around the source code for thin a while and see what kind of patch I can come up with.

Array of Hashes in Ruby



YEAR, MONTH, DAY, HOURS, MINUTES = 0, 1, 2, 3, 4

def getTimestamp(file_name)
lec =, “rb”) #, IO::SEEK_CUR)
timestamp =

timestamp = getTimestamp(“./DW_A0128.wav”)
puts “#{timestamp[MONTH]}/#{timestamp[DAY]}/#{timestamp[YEAR]+2000},\

1/26/2009, 8:57

No more having to deal with this voice recorder’s crappy program. >(