Skip to content

Instantly share code, notes, and snippets.

Brennan Vincello brennv

  • SF Yay Area, CA
Block or report user

Report or block brennv

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
brennv /
Last active Jul 20, 2017
pif: A simple diff wrapper for pip
# Diff pip freeze after pip install or uninstall
# Example usage: pif install foo
pif() {
if [[ $@ == *'install'* ]]; then
r1=$(mktemp) && pip freeze > r1
pip "$@"
r2=$(mktemp) && pip freeze > r2
echo ' Pip freeze diff:'
diff r1 r2
rm -f r1 r2
brennv /
Last active Jul 14, 2017
jump from the command line to the browser and search against specified sites
# Start a search against multiple sites from the command line
# Usage: python <search terms>
import sys
import subprocess
import webbrowser
from urllib.parse import quote
except ImportError:
from urllib import quote # python 2
brennv /
Last active May 19, 2017
Twitter -> Kafka -> RethinkDB: duplicate primary `id` trace

The fine folks at Datamountaineer have developed the stream-reactor making it easier to integrate data piplines with Kafka.

As a demo I'm streaming Twitter data to Kafka, and then from Kafka to RethinkDB.

Configs using Landoop's fast-data-dev environment:

Source: Twitter

brennv /
Last active Apr 8, 2017
Session Interface example for url-based session max_age flip-flopping in Flask
from werkzeug.datastructures import CallbackDict
from flask.sessions import SessionInterface, SessionMixin
from itsdangerous import URLSafeTimedSerializer, BadSignature
from datetime import datetime, timedelta
class ItsdangerousSession(CallbackDict, SessionMixin):
def __init__(self, initial=None):
def on_update(self):
self.modified = True
CallbackDict.__init__(self, initial, on_update)
View gist:fb6e167d14f3718c6dc0bafbcd43b3df

OpenShift Origin in AWS

This describes deploying and running OpenShift Origin in Amazon Web Services.

This is based upon the code and installer on 2014-02-26 so YMMV.

We will be using a VPC for deployment in us-east-1 and Route53 for DNS. I will leave the VPC setup as an exercise for the reader.


  • AWS Account
  • VPC
brennv / docker-compose.yaml
Last active Jul 5, 2016
Example local dev setup with arangodb
View docker-compose.yaml
# Consider adding image: jwilder/nginx-proxy for managing routes
version: '2'
image: arangodb/arangodb:3.0.0
- "8529:8529"
# Aggregate connection stats between source and destination apps
tshark -n -r example-file.pcap -T fields -e ip.src -e ip.dst -e tcp.dstport "tcp.flags == 0x0002" | sort | uniq -c | sort -nr
brennv / rh-openshift-error-codes.txt
Created May 24, 2016 — forked from caruccio/rh-openshift-error-codes.txt
RedHat Openshift error codes (extracted from source files - grep+python). Neither comprehensive or 100% correct, but it is a start...
View rh-openshift-error-codes.txt
404 Not Found:
101: "Application '#{id}' not found"
127: "Domain '#{domain_id}' not found"
404 Not Found:
163: "Cartridge '#{cartridge_name}' for application '#{app_id}' not found"
101: "Application '#{app_id}' not found for domain '#{domain_id}'"
import ephem
def is_daytime(city):
sun = ephem.Sun()
locale =
twilight = -12 *
is_sunlight = sun.alt > twilight
return is_sunlight
import os
import time
from datetime import datetime, timedelta
from tzlocal import get_localzone
def check_file_time_elpased(file_path):
ctime = time.ctime(os.path.getmtime(file_path))
last_updated = datetime.strptime(ctime), "%a %b %d %H:%M:%S %Y")
tz = get_localzone()
then = tz.normalize(tz.localize(last_updated))
You can’t perform that action at this time.