Skip to content

Instantly share code, notes, and snippets.

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

<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)
/* 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
// Load data tiles from an AJAX data source
L.TileLayer.Ajax = L.TileLayer.extend({
_requests: [],
_addTile: function (tilePoint) {
var tile = { datum: null, processed: false };
this._tiles[tilePoint.x + ':' + tilePoint.y] = tile;
this._loadTile(tile, tilePoint);
},
// XMLHttpRequest handler; closure over the XHR object, the layer, and the tile
_xhrHandler: function (req, layer, tile, tilePoint) {
@developerworks
developerworks / ROP.ex
Last active August 29, 2015 14:17 — forked from zabirauf/ROP.ex
defmodule ROP do
defmacro try_catch(args, func) do
quote do
(fn ->
try do
unquote(args) |> unquote(func)
rescue
e -> {:error, e}
end
@developerworks
developerworks / api_bridge.ex
Created November 3, 2015 17:33 — forked from upbit/api_bridge.ex
Module for rpc call remote api@node functions
defmodule ApiBridge do
@moduledoc """
Module for rpc call remote api@node functions.
"""
@defualt_rpc_timeout 3000
@doc """
rpc macro for api call
"""
defmacro rpc(exp, timeout \\ @defualt_rpc_timeout) do
@developerworks
developerworks / migration.py
Created April 27, 2016 08:42 — forked from lucperkins/migration.py
Migrate SQL table to Riak
import psycopg2
from riak import RiakClient, RiakObject
from riak.datatypes import Set
import datetime
# Riak connection and set
client = RiakClient(pb_port=8087)
SETS_BUCKET = client.bucket_type('sets').bucket('key_sets')
# Get columns for table
%% Author: Alex Radetsky <rad@pearlpbx.com>
%% Module: Simple SMPP Server on Erlang, gen_fsm, ranch, smpp34pdu.
%% It always authorize bind_transceiver and receives submit_sm
-module(smpp_protocol).
-behaviour(gen_fsm).
-behaviour(ranch_protocol).
-include_lib("smpp34pdu/include/smpp34pdu.hrl").