Skip to content

Instantly share code, notes, and snippets.

😀
Coding with Rust

Stephen Blum stephenlb

😀
Coding with Rust
Block or report user

Report or block stephenlb

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@krhoyt
krhoyt / pubnub.ino
Created Dec 2, 2014
Spark Core to PubNub
View pubnub.ino
// Libraries
#include <math.h>
// Literals
#define THERMISTOR A0
// Constants
// Thermistor computation
const float ANALOG_STEPS = 4095.0;
const float B_THERM = 3977.0;
@stephenlb
stephenlb / macvim-install.sh
Created Feb 18, 2012
MacVim Terminal Installation
View macvim-install.sh
## MacVim Good Terminal Only Installation Guide
## http://www.pubnub.com/
## http://twitter.com/pubnub
## USAGE - Copy+Paste this One-liner:
##
## bash <(curl https://raw.github.com/gist/1858026/macvim-install.sh)
##
## OR - Download this file and execute
@jeremyvdw
jeremyvdw / apubnub.rb
Created Mar 5, 2012
apublish & asubscribe PubNub methods (wrapped in Fibers)
View apubnub.rb
require 'eventmachine'
require 'em-http-request'
require 'yajl'
module PubSub
class Pubnub
#**
#* Pubnub
#*
#* Init the Pubnub Client API
@stephenlb
stephenlb / pam-example.py
Last active Jan 1, 2016
NEW UPDATE: https://github.com/pubnub/python/tree/master/python <-- PubNub Access Manager (PAM) Python Full Library for Granting and Revoking Access in Real-Time on the PubNub Real-Time Network.
View pam-example.py
import pam
## PubNub Access Manager (PAM)
manager = pam.access(
pubkey="pam",
subkey="pam",
seckey="pam"
)
## Grant User Access
@stephenlb
stephenlb / calculate-payload-size.js
Last active Jan 2, 2016
Calculating a PubNub Message Payload Size. This is necessary to prevent yourself from getting a "Message Too Large" gateway response.
View calculate-payload-size.js
(function(){
// Calculating a PubNub Message Payload Size.
function calculate_payload_size( channel, message ) {
return encodeURIComponent( channel + JSON.stringify(message) ).length + 97;
}
})();
@stephenlb
stephenlb / history.md
Last active Oct 3, 2016
PubNub History API V2
View history.md

PubNub History API V2

/v2/history/sub-key/<sub-key>/channel/<channel>?URL_PARAMETERS
URL Parameters:
start     (time token): Beginning of a timeline slice (exclusive)
@stephenlb
stephenlb / blocks-message-copy.js
Last active Feb 7, 2017
PubNub Message Copy - https://admin.pubnub.com/#/blocks/1165/import - Copy a Message between PubNub Keys 🎉
View blocks-message-copy.js
export default (request) => {
const xhr = require('xhr')
const pub_key = 'demo' // YOUR 2nd PUBLISH KEY
const sub_key = 'demo' // YOUR 2nd SUBSCRIBE KEY
const chncopy = request.channels[0]
const msgcopy = JSON.stringify(request.message)
const url = "http://pubsub.pubnub.com/publish/" + [
pub_key, sub_key, 0, chncopy, 0, msgcopy
].join('/')
@ajb413
ajb413 / index.js
Created May 1, 2018
audio lext test
View index.js
var AWS = require('aws-sdk');
AWS.config.update({
accessKeyId: "__id__",
secretAccessKey: "__secret__",
});
var lexruntime = new AWS.LexRuntime({region: 'us-east-1'});
@stephenlb
stephenlb / animated-gif.md
Last active Feb 6, 2019
DIY How to make your own HD Animated GIF Generator
View animated-gif.md

HD Animated GIF Generator

You can make your own HD animated GIF generator.
Follow along with these commands to get started.

HD Animated GIF Generator

git clone git://source.ffmpeg.org/ffmpeg.git
cd ffmpeg
@erichiggins
erichiggins / datastore_fetch_all.py
Last active Apr 26, 2019
Efficiently page over a Query to fetch all entities from the Google App Engine Datastore.
View datastore_fetch_all.py
#!/usr/bin/python
"""
Functions are provided for both the DB and NDB Datastore APIs.
References:
* https://cloud.google.com/appengine/docs/python/datastore/queries
* https://cloud.google.com/appengine/docs/python/ndb/queries
"""
def db_fetch_all(query, limit=100, cursor=None):
You can’t perform that action at this time.