What's Open Now?

Posted by Dave Eddy on Jun 18 2013 - tags: tech

You sit down to watch the LMN premier of Drew Peterson: Untouchable, when next thing you know, you just watched LMN for the last 6 hours, it is now 4am, and you’re hungry. The obvious question is “What’s open?”, but where do you find the answer?

What’s Open has the answer.

What’s Open is a free service that uses Google Maps to show what places are around you are currently open.

whats-open

Skye came up with the idea, and I wrote the code.

You can view the site here http://whatsopen.pw

As well as view the source code here https://github.com/bahamas10/whats-open


Synchronous File IO in Node.js

Posted by Dave Eddy on Mar 26 2013 - tags: tech

Does calling fs.writeFileSync trigger a synchronous write to the file system?

If you are familiar with Node.js, or have at least heard of it, you’ve most likely heard that it uses non-blocking IO, and lets you do work asynchronously. One of the most basic APIs that Node provides is for the file system; With this API, you can read, write, remove, etc. files and do other file system related tasks and modifications.

This API follows a standard pattern of exposing 2 functions for each operation: one for asynchronous work, and the other for synchronous work. For example, if you want to read a file in Node you can do so asynchronously:

var fs = require('fs');
fs.readFile('/etc/passwd', function(err, buf) {
  console.log(buf.toString());
});

Node will continue executing any javascript code it encounters while reading the file. Once all javascript is done being executed and the file is ready, it will run the anonymous function and print the file contents.

Read More...




Unfreeze Photoshop

Posted by Dave Eddy on Feb 27 2013 - tags: tech

Unfreeze a frozen Photoshop on Mac

I wrote an app to unfreeze a stuck or frozen photoshop. If you’re running photoshop, and it starts beachballing, or not responding on you, try running this. This application will help if suddenly you have a frozen photoshop, and you want to fix it.

Download the app

screenshot

Read more about it here


High Performance Node.js Logging with console.log buffering

Posted by Dave Eddy on Dec 06 2012 - tags: tech

Buffer calls to console.log, console.warn, etc. for high performance logging

Description

Calls to console.log, console.error, etc. are synchronous, and as such, will block the event loop while the data is being written to a file, terminal, socket, pipe, etc.

This module provides a seamless, drop-in buffer for all calls to these functions, and flushes them when the buffers exceed a certain size (8k by default).

See Known Issues for timing concerns with this module.

View the project on GitHub

Read More...


pcurl - Node Module

Posted by Dave Eddy on Oct 26 2012 - tags: tech

Concurrently curl a list of hosts and print the results

Pcurl

View the project page on GitHub

Usage

Used as a command line tool

pcurl url1 url2 url3 ...

or pipe through stdin

pcurl < newline_sep_list_of_urls.txt

Read More...


perms - Node Module

Posted by Dave Eddy on Sep 25 2012 - tags: tech

Convert Unix style permissions to strings like ls (0755 => ‘rwxr-xr-x’)

I wrote this module to make it easy to print out nice looking permissions in my scripts before calling fs.chmod for the user.

Examples

Given

var perms = require('perms');

Convert a mode to a human-readable string like ls(1) generates

var p = perms.toString('0755');
console.log(p);

yields

rwxr-xr-x

Read More...


Compiling watch(1) on SmartOS

Posted by Dave Eddy on Sep 18 2012 - tags: tech

watch - execute a program periodically, showing output fullscreen

Watch

Coming from Linux, I have become used to the watch tool. The program is very simple, it lets you run a command at a given interval, and update the terminal with the output. It’s like a simple while loop that runs a command, but it uses ncurses to update the view, which makes it easy to spot differences.

Compiling it on SmartOS was straight forward, the hardest part was finding the source of watch(1). It turns out it is bundled with a handful of tools for dealing with the Linux proc filesystem. Because of this, most of the tools wont compile (or be useful) on an Illumos based operating system, so the Makefile proved to not be helpful.

Read More...


Trace streams in Node.js

Posted by Dave Eddy on Aug 29 2012 - tags: tech

I was working on my latest module for node, latest, when I encountered a problem. While testing, I noticed output being written to the terminal that I wasn’t generating. This means that some module had the audacity to write directly to the terminal… bad.

My project was only including the npm module, however the npm module included its own handful of other modules, and they included their own modules, and so-on. If I were to look through the source myself to try and find what was outputting to the terminal it would have taken forever, trying to trace what function was calling what. Instead, I decided to override the stdout streams write function, to stack trace when invoked. This means that any function that writes to stdout will cause a stack trace to be printed to the screen.

Read More...