Skip to content

Instantly share code, notes, and snippets.

Coding with Rust

Stephen Blum stephenlb

Coding with Rust
View GitHub Profile
stephenlb /
Last active Aug 2, 2020
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 /
Last active Jun 30, 2020
DIY How to make your own HD Animated GIF Generator

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://
cd ffmpeg
stephenlb /
Last active May 25, 2020
NEW UPDATE: <-- PubNub Access Manager (PAM) Python Full Library for Granting and Revoking Access in Real-Time on the PubNub Real-Time Network.
import pam
## PubNub Access Manager (PAM)
manager = pam.access(
## Grant User Access
stephenlb / webrtc-demo.html
Last active Apr 21, 2020
WebRTC on localhost and HTTPS answer for StackOverflow - you must run an HTTPS server even on localhost.
View webrtc-demo.html
<!DOCTYPE html>
<form id='loginForm'>
<input id='username' placeholder='Pick a username!' />
<input type='submit' value='Log In'>
<form id='callForm'>
<input id='number' placeholder='Enter user to dial!' />
<input type='submit' value='Call'/>
stephenlb / pubnub-post.js
Last active Mar 7, 2020
PubNub POST Gzip Examples
View pubnub-post.js
var http = require("http");
var zlib = require("zlib");
exports.publish = function(msg) {
var req = http.request({
"host" : "",
"method" : "POST",
"path" : "/publish/demo/demo/0/my_channel/0",
"headers" : {
"Content-Encoding" : "gzip",
stephenlb /
Last active Feb 6, 2020
Python by Example 4.0 SDK PubNub
import pubnub#pubnub==4.0.2
import time
from pubnub.pnconfiguration import PNConfiguration
from pubnub.pubnub import PubNub
pnconf = PNConfiguration()
pnconf.subscribe_key = "demo"
pnconf.publish_key = "demo"
pubnub = PubNub(pnconf)
stephenlb /
Last active Jan 24, 2020
Network Throughput Bandwidth Rate Consumption Linux Command
## =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- USAGE -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
## ./ eth0
## =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
stephenlb /
Last active Jul 10, 2019
Bash and Shell Command PubNub Subscribe in One Line - Basic TCP Subscribe Calls
## =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
## URL Variables
## =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
## Demo Stream
while true; do (printf 'GET HTTP/1.1\r\nHost: pubnub\r\n\r\n'; sleep 5) | nc 80; done
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 / Procfile
Last active Apr 17, 2019
Twitter / PubNub Bridge - Heroku Worker
View Procfile
tweetstream: node twitter-pubnub-stream.js
You can’t perform that action at this time.