Skip to content

Instantly share code, notes, and snippets.


Blake VandeMerwe blakev

View GitHub Profile
blakev /
Last active May 1, 2019 15:21
Paramiko SSHClient Abstraction, includes batch commands and stdin
# Paramiko SSH Object with batch commands and stdin
# Blake VandeMerwe July 2014
# Adapted from Joe Linoff's code at
# his did not work for me, so I fixed it and added some features.
import re
import string
import logging
import socket
blakev /
Created July 18, 2014 20:50
Python Class @cache decorator
import time
import random
DEFAULT_CACHE_TIME = 5 # seconds
class A:
def __init__(self):
def cache(*args):
blakev /
Last active August 29, 2015 14:04
Uses itertools to add an "unravel" function...unravel takes iterables and cycles through them yielding the first element until all the elements are gone, or until a limit is reached.
import itertools
def unravel(*iterables, limit = None):
yield from itertools.islice(
*iterables))), limit)
# a = [x for x in range(10)]
blakev / JsonHash.js
Created August 18, 2014 03:16
JavaScript JSON Hashing
View JsonHash.js
var _ = require('underscore');
function hash(data) {
function innerHash(data) {
var hashStr = '';
if(_.isArray(data)) {
_.each(data, function(e) {
hashStr += innerHash(e) + ','
blakev / livestream
Last active August 29, 2015 14:06 — forked from deandob/livestream
View livestream
// Live video stream management for HTML5 video. Uses FFMPEG to connect to H.264 camera stream,
// Camera stream is remuxed to a MP4 stream for HTML5 video compatibility and segments are recorded for later playback
var liveStream = function (req, resp) { // handle each client request by instantiating a new FFMPEG instance
// For live streaming, create a fragmented MP4 file with empty moov (no seeking possible).
var reqUrl = url.parse(req.url, true)
var cameraName = typeof reqUrl.pathname === "string" ? reqUrl.pathname.substring(1) : undefined;
if (cameraName) {
try {
cameraName = decodeURIComponent(cameraName);
blakev /
Created December 2, 2014 20:11
Assembler and VM written in Python
#!/usr/bin/env python
import sys, os, re
errorDict = {
0: "Default error for, %s"
warningDict = {
0: "Default warning for, %s",
100:"%s Label already found in symbol table."
blakev /
Last active March 18, 2021 19:04
Command line application to search KSL Classifieds
import re
import argparse
import concurrent.futures
import string
from collections import namedtuple
from urllib.request import urlopen
from urllib.parse import urlencode
from bs4 import BeautifulSoup

Keybase proof

I hereby claim:

  • I am blakev on github.
  • I am blakev ( on keybase.
  • I have a public key whose fingerprint is E3B1 28F0 8A95 AAE9 8848 9EDE 5F45 7ACC AE59 619A

To claim this, I am signing this object:

View social counter totals
import os
import re
import sys
import json
import time
import requests
from bs4 import BeautifulSoup
from requests_oauthlib import OAuth1Session
from jinja2.environment import Environment
blakev /
Last active October 19, 2017 21:10
Background tasks manager for gevent Greenlets
#!/usr/bin/env python3
# ~*~ coding: utf-8 ~*~
# >>
# .. created: 5/20/16
# .. author: blake.vandemerwe
# <<