Skip to content

Instantly share code, notes, and snippets.

Brian Zambrano brianz

Block or report user

Report or block brianz

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
import RPi.GPIO as GPIO
import time
GPIO.setup(18, GPIO.IN, pull_up_down=GPIO.PUD_UP)
while True:
input_state = GPIO.input(18)
if input_state == False:
"""Simple script to read stdin postgresql csv logs and output the SQL statements
To use, do something like this:
tail -f /path/to/your/postgres.log | python -u
import csv
import sys
brianz /
Last active Jan 8, 2020
Install docker on Amazon Linux
# steps taken verbatim from:
sudo yum update -y
sudo yum install -y docker
sudo service docker start
sudo usermod -a -G docker ec2-user
# log out and log in to pickup the added group
brianz / logstash_fwder.conf
Created Sep 12, 2014
Get salt pillars from a specific grain
View logstash_fwder.conf
{% set instance_type = grains.get('instance_type', '') %}
{% set logstash_servers = salt['pillar.get'](instance_type + ':logstash_servers') %}
{% set logstash_paths = salt['pillar.get'](instance_type + ':logstash_paths') %}
{% set logstash_fields = salt['pillar.get'](instance_type + ':logstash_fields') %}
{% if logstash_servers and logstash_paths and logstash_fields %}
"network": {
"servers": {{ logstash_servers|json }}
brianz /
Created Sep 11, 2014
SimpleHTTPServer to echo the path from GET requests
import sys
import SimpleHTTPServer
import SocketServer
PORT = int(sys.argv[1])
except IndexError:
PORT = 8888
class EchoHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
brianz / getpip.sls
Created Jul 30, 2014
Salt sls for installing pip via
View getpip.sls
- name: /usr/local/sbin/
- source:
- source_hash: md5=3f120892a637a59a9c497d516eb2ca76
- name: /usr/bin/python /usr/local/sbin/
- unless: which pip
- require:
brianz / minion-or-master-config
Last active Aug 29, 2015
Multi environment salt minion or master config
View minion-or-master-config
master: localhost
file_client: local
- /srv/salt/base
- /srv/salt/dev
- /srv/salt/base
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'fileutils'
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
box = {
:django_fwd => 9000,
:elasticsearch_fwd => 9200,
You can’t perform that action at this time.