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 🙏

© 2025 – Pkg Stats / Ryan Hefner

twicmd

v0.0.3

Published

Send commands to your server with twitter

Readme

TwiCmd

TwiCmd is a small node module which enables triggering commands on a remote server using your public twitter stream.

Out hiking and need to restart nginx or run a script? Send a short Tweet

Connect it to your lights and use twitter to turn them on and off

###Concerns

  • My twitter stream is public, commands could reveal to much about the computer I am controlling. True, but you can name commands what ever you want. For example #yolo #bro to restart a service or clear a log.
  • It's not verbose enough. Any problem that can be diagnosed and fixed using a script is a potential candidate for a command

###Motivation

  • Everyone has Twitter (almost)
  • Twitter is available on all platforms (almost)
  • Twitter is mobile
  • Twitter handles authentication
  • SSH access is not as mobile

Examples

###Javascript

var TwiCmd = require("twicmd"),
	twitter = require("twitter"),
	twicmd, twitt;

twitt = new twitter({
	consumerKey: "Consumer key here",
	consumerSecret: "Consumer secret here",
	accessTokenKey: "Access token here",
	accessTokenSecret: "Access Secret here"
});

twicmd = new TwiCmd({
	tweetProvider: twitt,
	tweeters: ["xxxxxxxx"], //Numerical twitter ids
	commands: {
		test: function () { //Command triggered by #test
			console.log("test");
		}
	},
    //Tag needed to invoke a command besides the command tag
    //Defaults to #twicmd
	invokingTag: "#myCustomInvokingTag"
});

twicmd.addCommand("rs", function () {
	console.log("Restart a service")
});

twicmd.start();

setInterval(function() {},5000); //Prevent process shutdown

###Coffeescript

TwiCmd  = require("twicmd")
twitter = require("twitter")

twitt = new twitter
                consumerKey: "Consumer key here"
                consumerSecret: "Consumer secret here"
                accessTokenKey: "Access token here"
                accessTokenSecret: "Access Secret here"

twicmd = new TwiCmd
                tweetProvider: twitt
                tweeters: ["xxxxxxxxxxx"] #Numerical twitter ids
                commands:
                        test: ->    #Available command triggered by #test
                            console.log "Test"
                invokingTag: "#mycustominvokingtag"

twicmd.addCommand "rs", () ->
    console.log "Restart a service"

twicmd.start()

setInterval (->), 5000 #Prevent process shutdown

Documentation

###TwiCmd Constructor TwiCmd (parameters)

####tweeters

An array of twitter ids specifying who can trigger commands. Only direct tweets from these tweeters can trigger commands. If the array is left empty twicmd runs in public mode were anyone can trigger commands, this is not recommended.

####Commands An object representing the available commands. Each key will represent a command. Commands are invoked by using them in tweets as hashtags along with the invoking tag. The value of each key should be a function to run when the command is triggered.

Example

{
	restart: function () {/* … */},
	stop: function () {/* … */}

}

Triggering the restart command is done with the following tweet #twicmd #restart given that the invoking tag has not been changed from the default.

####TweetProvider A tweet provider. The node module twitter is suggested. The tweet provider should provide a method called stream with the same signature as the stream method in the twitter module.

####invokingTag

The extra tag required to invoke a command besides the command tag.

Default: #twicmd

License

MIT, see license file