Skip to content

Instantly share code, notes, and snippets.

sub.on('subscribe', function(channel){
console.log('SUBSCRIBED TO CH: ' + channel);
Events.emit('subscribed:' + num, channel);
});
sub.on('message', function(chanel, message){
console.log('ONMESSAGE FROM CH: ' + chanel + ' with message ' + message);
});
sub.subscribe('msg:' + num);
var events = require('events');
var Events = new events.EventEmitter;
var redis = require('redis');
var store = redis.createClient(6379, 'localhost');
var pub = redis.createClient(6379, 'localhost');
var sub = redis.createClient(6379, 'localhost');
sub.setMaxListeners(0);
sub.subscribed = false;
@kpnemo
kpnemo / gigitalocean_vpn.sh
Last active November 23, 2015 09:11
digitalocean vpn
#!/bin/bash
echo "Select on option:"
echo "1) Set up new PoPToP server AND create one user"
echo "2) Create additional users"
read x
if test $x -eq 1; then
echo "Enter username that you want to create (eg. client1 or john):"
read u
echo "Specify password that you want the server to use:"
read p
@kpnemo
kpnemo / gigitalocean_vpn_pub.sh
Created October 19, 2014 21:29
digitalocean_vpn_public
#!/bin/bash
echo "Select on option:"
echo "1) Set up new PoPToP server AND create one user"
echo "2) Create additional users"
read x
if test $x -eq 1; then
echo "Enter username that you want to create (eg. client1 or john):"
read u
echo "Specify password that you want the server to use:"
read p
@kpnemo
kpnemo / users_groups_showobox.md
Last active August 29, 2015 14:07
users_groups_showbox

mongo #Users { _id: 'user_id', name: 'name', group: ['group_id', 'group_id'], // or null if not part of any group role: 'role_id' }

mongo #Groups {

{
"normal" : {
"rtmp_url" : "rtmp://s3nk7dw67yrgbd.cloudfront.net/uploads/videos/544e6be461706912a31c0000/normal.mp4",
"height" : 720,
"resolution" : "1280x720",
"width" : 1280,
"size" : 3702226,
"origin_url" : "http://showbox-env-prod1-media-items.s3.amazonaws.com/uploads/videos/544e6be461706912a31c0000/normal.mp4",
"state" : "ready",
"url" : "https://d1hlu1y29anwda.cloudfront.net/uploads/videos/544e6be461706912a31c0000/normal.mp4"
{"user_id":"5313315225a71e7a278d9084","type":"video","file":"http://dduspq5t4szzs.cloudfront.net/tmp-user-upload/5f0d15836c4debca6c4b896e68bd413e_original__1_.mp4","title":"original (1)","source":"web:upload"}
{
"sprite" : {
"state" : "pending"
},
"source" : "web:upload",
"elastic_transcoder_retries_count" : 0,
"title" : "original (1)",
"original_filename" : "5f0d15836c4debca6c4b896e68bd413e_original__1_.mp4",
"tags" : [],
"file_filename" : "original.mp4",
{
"original_json": {
"_id": "544e77566170690a24100000",
"aux": null,
"created_at": "2014-10-27T16:48:22.097Z",
"deleted_at": null,
"exclude_renditions": [
"normal"
],
"file": "http://worker2.staging.env.showbox.com:1234/downloads/82aeb578378d4590924e4b6a09eb1653.mp4",
var formats = {
company: {
openerCmsId: 'myCompany_logo',
superCmsId: 'myCompanySuper',
popupLeft: 'myCompany_popUp_left',
vs1: 'studio_106',
vs2: 'Loft_studio',
transition: 'wipe_corner',
shotIndex: 0
},