Skip to content

Instantly share code, notes, and snippets.

View stephenlb's full-sized avatar
😀
Coding with Rust

Stephen Blum stephenlb

😀
Coding with Rust
View GitHub Profile
@stephenlb
stephenlb / subscribe.py
Created August 8, 2018 01:54
Python Subscribe: Basic Worker. Super Simple
import multiprocessing
import requests
SUB_KEY = 'demo'
CHANNELS = ['my_channel']
def main():
mp = multiprocessing.Process(target=subscriber)
mp.start()
mp.join()
@stephenlb
stephenlb / index.js
Created May 1, 2018 17:09 — forked from ajb413/index.js
audio lext test
var AWS = require('aws-sdk');
AWS.config.update({
accessKeyId: "__id__",
secretAccessKey: "__secret__",
});
var lexruntime = new AWS.LexRuntime({region: 'us-east-1'});
@stephenlb
stephenlb / index.js
Last active July 6, 2021 18:23
PubNub Function for Microsoft's Translate V3 API
const PubNub = require('pubnub');
const readline = require('readline');
const pubnub = new PubNub({
publishKey: "pub-c-716a3b86-1770-4e00-985f-f12211d9def9",
subscribeKey: "sub-c-535a73fe-de7d-11eb-ad9d-a277214e1d91",
});
const channel = "translate";
pubnub.addListener({
message: function(event) {
@stephenlb
stephenlb / pubnub-smart-contract.sol
Last active January 31, 2018 22:13
PubNub on Ethereum "Web3" Decentralized Network as a Smart Contract
pragma solidity ^0.4.19;
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// PubNub on Ethereum "Web3" Decentralized Network as a Smart Contract
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
contract PubNubV1 {
mapping(bytes32 => mapping(bytes32 => bytes32)) private channel_groups;
mapping(bytes32 => mapping(bytes32 => bytes32)) private channel_presence;
event Message(
@stephenlb
stephenlb / always-readme.md
Last active April 14, 2023 13:38
Solidity Smart Contract all-in-one that allows the crowd-sale of custom tokens for as long as the owner wallet balance is above zero. See readme for more details.

Simplified Modifiable ERC20 Token Details

Controllable Crowd-sale and transferable ownership allows you to change ownership and change exchange rates.

  • Owner Wallet receives ETH funds.
  • Owner Wallet holds TOKEN's for sale.
  • Moving tokens from owner wallet to another removes publicly purchaseable token inventory.
  • Custom Exchange Rate ETH for YOUR TOKEN. Default is 1:10 One ETH = 10 YOUR TOKEN.
  • Changable Exchange Rate at any time!
@stephenlb
stephenlb / cryptoDashboard.html
Last active December 13, 2020 14:43
Realtime Ticker Price Changes for Ethereum, Bitcoin and Litecoin.
<!DOCTYPE html>
<html>
<head>
<title>Crypto Currency Prices</title>
<script src="https://cdn.pubnub.com/sdk/javascript/pubnub.4.18.0.min.js"></script>
<script type="text/javascript" src="https://pubnub.github.io/eon/v/eon/1.0.0/eon.js"></script>
<link type="text/css" rel="stylesheet" href="https://pubnub.github.io/eon/v/eon/1.0.0/eon.css"/>
</head>
<body>
- (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection {
// if we're paused don't do anything
if(self.currentState==STATE_PAUSED) {
// reset our frame counter
self.validFrameCounter=0;
return;
}
@stephenlb
stephenlb / 1.js
Created November 15, 2017 21:06 — forked from domadev812/1.js
Streaming Sensor Readings to a Realtime Gauge Chart
var five = require("johnny-five");
var board = new five.Board();
var pubnub = new PubNub({
subscribeKey: "mySubscribeKey",
publishKey: "myPublishKey",
ssl: true
})
@stephenlb
stephenlb / publishMsg.c
Created November 15, 2017 21:06 — forked from domadev812/publishMsg.c
Code chunks from project javamon
// Publish the value using PubNub
static void publishMsg (void)
{
// Check values for I2C line error...
if (TWI_msg[0] > 99 || TWI_msg[1] > 99) {
TWI_fullMsg = 10000;
}
// Ignore very small values
else if (TWI_msg[0] == 0 && TWI_msg[1] < 50) {
TWI_fullMsg = 0;
@stephenlb
stephenlb / 1.h
Created November 15, 2017 21:06 — forked from domadev812/1.h
Arduino To PubNub In Two Steps
#include <SPI.h>
#include <Ethernet.h>
#include <Pubnub.h>
#include "string.h"
#include "iotconnector.h"
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
char pubkey[] = "PUBLISH KEYS HERE";char subkey[] = "SUBSCRIBE KEYS HERE";char channel[] = "iotchannel";char uuid[] = "Arduino";