npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ugly

v1.1.10

Published

A universal graphics library.

Downloads

53

Readme

ugly

Ugly is a light-weight language-agnostic 2D graphics library.

Why does this exist?

  • The canvas API is very nice, but Javascript isn't as powerful as low-level languages like C
  • Low level languages like C require lots of hoop-jumping before you can easily draw on the screen

ugly solves both of these problems. Harnassing a simple text-stream interface between programs, ugly takes in commands in real-time and forwards them via WebSockets to a local Javascript client, rendering your drawings on an HTML5 canvas for your viewing pleasure.

Installation

Install with npm:

npm install -g ugly

Or clone the repo, and install:

git clone https://github.com/williamg/ugly.git
cd ugly
npm install -g

Usage

To use ugly, make sure your application outputs text according to the ugly protocol on standard out.

yourprogram | ugly

Now, head to localhost:3333/viewer/ and enjoy the show!

Options

There are a few command line options available:

  • -p: Change the port used to serve the client (default is 3333). (Make sure this is not set to 4444 as that port is the hard-coded WebSocket port)

  • -l: Change where the log file is written (default is 'ugly.log')

  • -r: The framerate at which the server will try to send frames. (default is 120) Note that the rate at which ugly sends frames has nothing to do with the rate it receives commands. So it can receive all the commands at once and still render them at the right speed. This is helpful if you have a pre-generated ugly script:

      cat uglyScript | ugly -r 60

    If you are generating commands in realtime, as long as the rate is a positive multiple of your actual framerate, ugly will keep up with your program and render in as-close-to-realtime as it can.

  • -v: Set the verbosity (0-3):

    • 0: Nothing logged to file or console
    • 1: Nothing logged to console, everything logged to file
    • 2: Errors logged to console, everything logged to file (default)
    • 3: Everything logged to file and console
  • -s: Set the websocket port. Make sure this is different from the port used to server the viewer (default is 4444)

Examples

There's an example included in the examples directory. You can run it in either of the following ways:

If you have python:

python examples/midpointDisplacement.py | ugly

If you don't (or if you do and don't want to use it)

cat examples/midpointDisplacementOutput.txt | ugly -r 1

Commands

To learn more about the commands supported by ugly, please refer to the wiki page: Commands

Contributing

Pull requests are welcome and encouraged! Potential features that aren't yet implemented:

  • Support for directly creating and manipulating imageData
  • Some way to capture input from the viewer and pipe it back to the server so it can be made accessible in real-time to the original application
  • Clever ways of compressing the amount of data sent from the server to the client (even just sending all the commands in one send as opposed to one send per line may help, or it may make things worse)

Style

Please adhere to existing style as much as possible:

  • 4-space tabs for indentation, spaces for alignment
  • <= 80 character lines
  • Spaces before parentheses

Contributors

Special thanks to those who have helped improve ugly: