Skip to content

Instantly share code, notes, and snippets.

<link rel="import" href="../code-mirror/code-mirror.html">
<polymer-element name="my-element">
<template>
<style>
#code_mirror {
width: 400px;
height: 300px;
left: 260px;
var spawn = require('child_process').spawn,
sys = require('sys');
function createSSH(passphrase, path, name) {
var ssh = spawn('ssh-keygen', ['-trsa', '-N \''+ passphrase +'\'', '-f ' + name], { cwd:path, env: process.env, customFds: [-1, -1, -1]})
ssh.on('exit', function (code, signal) {
process.exit();
});

Getting Started with NPM (as a developer)

If you haven't already set your NPM author info, now you should:

npm set init.author.name "Your Name"
npm set init.author.email "you@example.com"
npm set init.author.url "http://yourblog.com"

npm adduser

@developerworks
developerworks / androidpn.upstart.conf
Created August 26, 2014 02:52
Android Push Server Upstart Configuration File
author "hezhiqiang"
description "Android Push Server"
start on runlevel [3]
stop on starting rc RUNLEVEL=[016]
respawn
respawn limit 10 5
expect fork
env BASEDIR=/opt/androidpn-server-bin-jetty
env CLASSPATH=$BASEDIR/conf
env LOG=$BASEDIR/logs/androidpn.log
@developerworks
developerworks / console-admin-server.upstart.conf
Created August 26, 2014 02:55
Ubuntu Upstart Configuration for Node.js Forever
author "hezhiqiang"
description "Console Admin Server"
start on runlevel [2345]
stop on starting rc RUNLEVEL=[016]
expect fork
env NODE_BIN_DIR="/usr/local/bin"
env NODE_PATH="/usr/local/lib/node_modules"
<body xmlns="http://jabber.org/protocol/httpbind"
sid="e0408bf8d86f0a7f44afda59aa8f81b75d029bb6"
wait="60"
requests="2"
inactivity="30"
maxpause="120"
polling="2"
ver="1.6"
from="ymc-pg-ejabberd"
secure="true"
# How to echobot with XMPP, BOSH, and Strophe
1. Setup ejabberd(http://www.ejabberd.im/) server and setup account admin@localhost.local
NOTE: localhost should be enough. If you setup something else, make sure you add it at /etc/hosts like this
#/etc/hosts
127.0.0.1 localhost.local
NOTE: Also download Psi(http://psi-im.org/), and make sure you can connect to your ejabberd server.
2. Download strophe(http://code.stanziq.com/strophe/) and place it (eg: /Users/makoto/work/sample/strophejs-1.0)
###
### ejabberd configuration file
###
###
### The parameters used in this configuration file are explained in more detail
### in the ejabberd Installation and Operation Guide.
### Please consult the Guide in case of doubts, it is included with
### your copy of ejabberd, and is also available online at
### http://www.process-one.net/en/ejabberd/docs/
@developerworks
developerworks / mod_muc_member_list.erl
Created September 29, 2014 19:21
Ejabberd module: get room members
%% 参考资源
%% https://www.ejabberd.im/node/4159?q=node/4159
%% http://blog.zlxstar.me/blog/2013/07/21/dicorvery-user-muclist/
-module(mod_muc_member_list).
-author('hezhiqiang').
-behaviour(gen_mod).
-include("ejabberd.hrl").
-include("jlib.hrl").
-include("logger.hrl").
-define(NS_MUC_MEMBER_LIST, <<"http://jabber.org/protocol/muc#member-list">>).
/* global Application, ObjC, $ */
/**
* repozish.js
*
* this is an example of using os x yosemite's "JavaScript for Automation":
*
* https://developer.apple.com/library/prerelease/mac/releasenotes/interapplicationcommunication/rn-javascriptforautomation/index.html
*
* it repositions some windows based on some position settings. you can run