This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const http = require("xhr"); | |
const pubnub = require("pubnub"); | |
// const dataUrl = 'https://gist.githubusercontent.com/stephenlb/2ed6782ee9ad47854dfb26028e0ca79c/raw/b6c9580ce624cfadc5be66123e3a1df1165dd047/test-data.json'; | |
const dataUrl = 'https://gist.githubusercontent.com/stephenlb/2ed6782ee9ad47854dfb26028e0ca79c/raw/9fc8b7e62fcb7fcdfe3ce87f7003b316540fba1b/test-data-300.json' | |
let data = null; | |
let position = 0; | |
/* data synth sinusoidal */ | |
const wavelength = 20; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Import Modules | |
// | |
const pubnub = require('pubnub'); | |
const xhr = require('xhr'); | |
const vault = require('vault'); | |
// | |
// Request Event Handler (Main) | |
// |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PNConfiguration configPrimary = new PNConfiguration(new UserId("myUserId")); | |
configPrimary.setSubscribeKey("mySubscribeKey"); | |
configPrimary.setPublishKey("myPublishKey"); | |
configPrimary.setOrigin("primary.pubnubapi.com"); | |
PNConfiguration configBackupOne = new PNConfiguration(new UserId("myUserId")); | |
configBackupOne.setSubscribeKey("mySubscribeKey"); | |
configBackupOne.setPublishKey("myPublishKey"); | |
configBackupOne.setOrigin("backup-1.pubnubapi.com"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
export SPACE_ID="hexgrid-id-6789x3845" | |
export SPACE_NAME="Queensland" | |
export USER_ID="michael-12345" | |
export USER_NAME="Michael" | |
export ASSET_ID="$USER_ID-asset-drone-1" | |
export SUBSCRIBE_KEY="demo" ## use 'demo' key for testing | |
## User Create | |
curl -s -X PUT -d '{"name":"'$USER_NAME'", "status":"offline", "custom":{"assets":["'$ASSET_ID'"]}}' -H 'Content-Type: application/json' https://ps.pndsn.com/v3/objects/$SUBSCRIBE_KEY/users/$USER_ID |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="pubnub.js"></script> | |
<script>(async()=>{ | |
'use strict'; | |
const pubnub = PubNub({ subscribeKey: 'demo', publishKey: 'demo' }); | |
pubnub.subscribe({ | |
channel: 'my_channel', | |
messages: (message) => document.body.innerHTML += `<div>${message}</div>`, | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Open Dev Console | |
<script>(async ()=>{ | |
'use strict'; | |
let secret = "sec-demo"; | |
let enc = new TextEncoder("utf-8"); | |
let body = "GET\npub-demo\n/v2/auth/grant/sub-key/sub-demo\nauth=myAuthKey&g=1&target-uuid=user-1×tamp=1595619509&ttl=300"; | |
let algorithm = { name: "HMAC", hash: "SHA-256" }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
## - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
## Usage | |
## - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
## | |
## ./tls.sh <SERVER_IP_OR_DOMAIN_NAME> | |
## | |
## ./tls.sh pubnub.com | |
## ./tls.sh ps.pndsn.com |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from __future__ import print_function | |
import struct | |
HTTP2_HEADER="PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n" | |
# Does the thing for a frame | |
def frame(ty, flags, streamid, payload): | |
return struct.pack(">L", len(payload))[1:4] + struct.pack(">BBL", ty, flags, streamid) + payload |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import multiprocessing | |
import requests | |
SUB_KEY = 'demo' | |
CHANNELS = ['my_channel'] | |
def main(): | |
mp = multiprocessing.Process(target=subscriber) | |
mp.start() | |
mp.join() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var AWS = require('aws-sdk'); | |
AWS.config.update({ | |
accessKeyId: "__id__", | |
secretAccessKey: "__secret__", | |
}); | |
var lexruntime = new AWS.LexRuntime({region: 'us-east-1'}); | |