Skip to content

Instantly share code, notes, and snippets.

😀
Coding with Rust

Stephen Blum stephenlb

😀
Coding with Rust
View GitHub Profile
@stephenlb
stephenlb / always-readme.md
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.
View always-readme.md

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 / animated-gif.md
Last active Jun 30, 2020
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
@stephenlb
stephenlb / pam-example.py
Last active May 25, 2020
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 / webrtc-demo.html
Last active Apr 21, 2020
WebRTC on localhost and HTTPS answer for StackOverflow http://stackoverflow.com/a/41969170/524733 - you must run an HTTPS server even on localhost.
View webrtc-demo.html
<!DOCTYPE html>
<html>
<form id='loginForm'>
<input id='username' placeholder='Pick a username!' />
<input type='submit' value='Log In'>
</form>
<form id='callForm'>
<input id='number' placeholder='Enter user to dial!' />
<input type='submit' value='Call'/>
@stephenlb
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" : "pubsub.pubnub.com",
"method" : "POST",
"path" : "/publish/demo/demo/0/my_channel/0",
"headers" : {
"Content-Encoding" : "gzip",
@stephenlb
stephenlb / pubnub-python-publish.py
Last active Feb 6, 2020
Python by Example 4.0 SDK PubNub
View pubnub-python-publish.py
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
stephenlb / network-rate.sh
Last active Jan 24, 2020
Network Throughput Bandwidth Rate Consumption Linux Command
View network-rate.sh
#!/bin/bash
## =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- USAGE -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
##
## ./network-rate.sh eth0
##
## =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
tx_bytes=0
@stephenlb
stephenlb / subscribe.sh
Last active Jul 10, 2019
Bash and Shell Command PubNub Subscribe in One Line - Basic TCP Subscribe Calls
View subscribe.sh
## =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
## URL Variables
## http://p.pubnub.com/stream/<SUBKEY>/<CHANNEL>/0/-1
## =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
## Demo Stream
while true; do (printf 'GET http://p.pubnub.com/stream/sub-c-5f1b7c8e-fbee-11e3-aa40-02ee2ddab7fe/pubnub-sensor-network/0/-1 HTTP/1.1\r\nHost: pubnub\r\n\r\n'; sleep 5) | nc p.pubnub.com 80; done
@stephenlb
stephenlb / http2-request.py
Last active Jun 4, 2019
Make an HTTP/2 Request, works as a PIPE command into openssl s_client.
View http2-request.py
#!/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
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.