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
stephenlb / always-readme.md
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.
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 / 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 / webrtc-demo.html
Last active Jun 30, 2019
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 / 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
@stephenlb
stephenlb / https.py
Last active Mar 2, 2019
HTTPS Server - All-in-One Secure HTTPS Server
View https.py
#!/usr/bin/python
# server
# python https.py
#
# browser
# https://0.0.0.0:4443
import BaseHTTPServer
import SimpleHTTPServer
@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
View 1.html
Enter Chat and press enter
<div><input id=input placeholder=you-chat-here /></div>
Chat Output
<div id=box></div>
<script src=http://cdn.pubnub.com/pubnub.min.js></script>
<script>(function(){
var pubnub = PUBNUB.init({publish_key:'demo',subscribe_key:'demo',ssl:true});
var box = PUBNUB.$('box'), input = PUBNUB.$('input'), channel = 'chat';
@stephenlb
stephenlb / subscribe.py
Created Aug 8, 2018
Python Subscribe: Basic Worker. Super Simple
View subscribe.py
import multiprocessing
import requests
SUB_KEY = 'demo'
CHANNELS = ['my_channel']
def main():
mp = multiprocessing.Process(target=subscriber)
mp.start()
mp.join()
@stephenlb
stephenlb / pubnub-python-publish.py
Last active Jul 23, 2018
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)
You can’t perform that action at this time.