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
stephenlb /
Last active Jun 4, 2019
Make an HTTP/2 Request, works as a PIPE command into openssl s_client.
#!/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
stephenlb /
Created Aug 8, 2018
Python Subscribe: Basic Worker. Super Simple
import multiprocessing
import requests
SUB_KEY = 'demo'
CHANNELS = ['my_channel']
def main():
mp = multiprocessing.Process(target=subscriber)
stephenlb / index.js
Created May 1, 2018 — forked from ajb413/index.js
audio lext test
View index.js
var AWS = require('aws-sdk');
accessKeyId: "__id__",
secretAccessKey: "__secret__",
var lexruntime = new AWS.LexRuntime({region: 'us-east-1'});
stephenlb / microsoft-translate-v3.js
Last active Apr 12, 2018
PubNub BLOCK for Microsoft's Translate V3 API
View microsoft-translate-v3.js
// Demo URL
// 1.) Click "My Secrets" button.
// 2.) Add a new Secret 'Ocp-Apim-Subscription-Key'
// 3.) Paste in your Microsoft Translator V3 API Key
// 4.) Save
// 5.) Restart/Start your Module
stephenlb / pubnub-smart-contract.sol
Last active Jan 31, 2018
PubNub on Ethereum "Web3" Decentralized Network as a Smart Contract
View pubnub-smart-contract.sol
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 /
Last active Sep 15, 2019
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 / cryptoDashboard.html
Last active May 5, 2018
Realtime Ticker Price Changes for Ethereum, Bitcoin and Litecoin.
View cryptoDashboard.html
<!DOCTYPE html>
<title>Crypto Currency Prices</title>
<script src=""></script>
<script type="text/javascript" src=""></script>
<link type="text/css" rel="stylesheet" href=""/>
View pubnubheartrateios-captureframe
- (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
stephenlb / 1.js
Created Nov 15, 2017 — forked from developingstar/1.js
Streaming Sensor Readings to a Realtime Gauge Chart
View 1.js
var five = require("johnny-five");
var board = new five.Board();
var pubnub = new PubNub({
subscribeKey: "mySubscribeKey",
publishKey: "myPublishKey",
ssl: true
stephenlb / publishMsg.c
Created Nov 15, 2017 — forked from developingstar/publishMsg.c
Code chunks from project javamon
View publishMsg.c
// 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;
You can’t perform that action at this time.