Skip to content

Instantly share code, notes, and snippets.

View stephenlb's full-sized avatar
😁
Coding Python, Rust, JavaScript, AI

Stephen Blum stephenlb

😁
Coding Python, Rust, JavaScript, AI
View GitHub Profile
@stephenlb
stephenlb / internet-dns-scanner.py
Last active January 4, 2017 22:26
Do you use Dyn DNS? Do you think your Domain is being Blocked? - Nameserver Scanner for ISPs in Regions of the World - Net Neutrality! Why don't you scan the internet's known Nameservers (DNS Servers) to find out. The Python Scanner will test two control domains before testing your target domain. If both control domains pass, and your target dom…
## =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
## Libs
## =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
import multiprocessing
import subprocess
import librato
import json
import sys
import os
@stephenlb
stephenlb / pubnub-nameserver-test.sh
Last active January 4, 2017 01:43
Nameserver Test for PubNub
while /bin/true;
do for ns in 205.251.195.139 208.78.71.19 205.251.192.22 205.251.196.103 204.13.251.19 208.78.70.19 205.251.199.187 204.13.250.19;
do NOW=`date`;
echo -ne "$NOW\tTesting $ns\t";
dig +time=1 +tries=1 +norecurse pubsub.pubnub.com @$ns | grep -oE 'status: [^,]+';
done;
sleep 30;
done | tee logs
@stephenlb
stephenlb / dig.txt
Created January 4, 2017 18:18
Dyn Nameservers SERVFAIL
$ dig +notcp +tries=1 +norecurse @208.78.70.19 ps.pndsn.com
; <<>> DiG 9.8.1-P1 <<>> +notcp +tries=1 +norecurse @208.78.70.19 ps.pndsn.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 55220
;; flags: qr; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;ps.pndsn.com. IN A
@stephenlb
stephenlb / webrtc-demo.html
Last active August 31, 2020 21:34
WebRTC on localhost and HTTPS answer for StackOverflow http://stackoverflow.com/a/41969170/524733 - you must run an HTTPS server even on localhost.
<!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 / makeuser.sh
Created February 14, 2017 04:16
Adding a User to Debian
USER="$1"
echo "Making user account for: $USER"
useradd -m -d /home/$USER -s /bin/bash $USER
usermod -aG sudo $USER
mkdir /home/$USER/.ssh
touch /home/$USER/.ssh/authorized_keys
chmod 700 /home/$USER/.ssh
chmod 600 /home/$USER/.ssh/authorized_keys
@stephenlb
stephenlb / aes-256-generator.sh
Last active August 9, 2017 19:09
Generate Encrypted Phrases from Command Line
echo -n "Hello how are you?" | \
openssl enc -e -base64 -aes-256-cfb -nopad -nosalt \
-k `echo -e "$RANDOM $RANDOM $RANDOM" | base64`
@stephenlb
stephenlb / eliza.js
Created November 7, 2017 22:39
ElizaBot PubNub Functions
export default (request, response) => {
const pubnub = require('pubnub');
const kvstore = require('kvstore');
const xhr = require('xhr');
let headersObject = request.headers;
let paramsObject = request.params;
let methodString = request.method;
let bodyString = request.body;
@stephenlb
stephenlb / cordova-1.html
Created November 15, 2017 21:05 — forked from domadev812/cordova-1.html
Snippets for blog, "Sending Android Push Notifications via GCM in JavaScript using PhoneGap and PubNub"
<script type="text/javascript" src="js/PushNotification.js"></script>
<script src="https://cdn.pubnub.com/sdk/javascript/pubnub.4.17.0.js"></script>
@stephenlb
stephenlb / pubnub-js-publish
Created November 15, 2017 21:05 — forked from domadev812/pubnub-js-publish
pubnub_iot_tech_uc_1
$('#toggle').click(function(e){
pubmsg = { "req" : "toggle" };
var publishConfig = {
channel : 'gpio-raspberry-control',
message : pubmsg
}
pubnub.publish(publishConfig, function(status, response) {
console.log(status, response);
@stephenlb
stephenlb / 02.html
Created November 15, 2017 21:05 — forked from domadev812/02.html
WebRTC Parts 1-3 Edits
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://cdn.pubnub.com/sdk/javascript/pubnub.4.17.0.js"></script>
<script src="https://cdn.pubnub.com/webrtc/webrtc.js"></script>