Skip to content

Instantly share code, notes, and snippets.

View jmvrbanac's full-sized avatar

John Vrbanac jmvrbanac

View GitHub Profile
@jmvrbanac
jmvrbanac / keybase.md
Last active August 29, 2015 14:07
Keybase Verify

Keybase proof

I hereby claim:

  • I am jmvrbanac on github.
  • I am jmvrbanac (https://keybase.io/jmvrbanac) on keybase.
  • I have a public key whose fingerprint is F600 EECD C4B2 924A 594D 533D 757C 935C 3017 42A4

To claim this, I am signing this object:

@jmvrbanac
jmvrbanac / setup_dev_barbican_keystone_endpoint.sh
Last active August 29, 2015 14:08
Add the Barbican service user and endpoint to a dev keystone
#!/bin/bash
get_id () {
echo `$@ | awk '/ id / { print $4 }'`
}
export OS_SERVICE_TOKEN="ADMIN_TOKEN"
export OS_SERVICE_ENDPOINT="http://localhost:35357/v2.0"
SERVICE_ID=$(get_id keystone service-create --name=barbican --type="key-manager" --description="Key_Management_Service")
@jmvrbanac
jmvrbanac / setting_up_postgres_for_barbican.md
Last active August 29, 2015 14:15
Setting up a Postgres Docker container to run with Barbican
  1. Execute
sudo docker run --name postgres -p 5432:5432 -e POSTGRES_PASSWORD=CHANGEME -d postgres
  1. Execute psql -h localhost -U postgres

  2. Within the psql shell execute the following lines

CREATE USER barbican WITH PASSWORD 'ALLTHEPASS';
@jmvrbanac
jmvrbanac / main.rs
Created February 24, 2015 00:50
Playing with bitflags in rust
#[macro_use]
extern crate bitflags;
mod something;
fn main() {
let e1 = something::FLAG_A | something::FLAG_C;
let e2 = something::FLAG_B | something::FLAG_C;
assert!((e1 | e2) == something::FLAG_ABC); // union
assert!((e1 & e2) == something::FLAG_C); // intersection
@jmvrbanac
jmvrbanac / kernel_builder.sh
Created July 4, 2015 23:43
Ath10k Kernel Builder
#!/bin/sh
apt-get update
apt-get install -y vim git libncurses5-dev gcc make screen kernel-package python-pip python-dev libffi-dev htop
apt-get build-dep -y linux-image-3.19.0-21-generic
# Download custom ath10k kernel fork
git clone https://github.com/kvalo/ath.git ath
cd ath
# Checkout 4.1.0-rc7
@jmvrbanac
jmvrbanac / postactivate
Last active September 2, 2016 01:51
Custom pip index per virtualenv (using virtualenvwrapper)
#!/bin/bash
# This hook is sourced after every virtualenv is activated.
# This belongs in $WORKON_HOME/postactivate
VIRTUAL_ENV_NAME=${VIRTUAL_ENV##*/}
if [[ $VIRTUAL_ENV_NAME == *"custom_prefix_"* ]]
then
export PIP_INDEX_URL="https://pypi.python.org/simple"
else
# Put this line in postdeactivate as well
@jmvrbanac
jmvrbanac / barbican-api-paste.ini
Last active November 17, 2015 20:21
Gunicorn Barbican Config
[composite:main]
use = egg:Paste#urlmap
/: barbican_version
/v1: barbican_api
[pipeline:barbican_version]
pipeline = versionapp
[pipeline:barbican_api]
pipeline = unauthenticated-context apiapp
@jmvrbanac
jmvrbanac / app.py
Created February 18, 2016 01:05
Using Jinja2 with Falcon
import os
import falcon
import jinja2
def load_template(name):
path = os.path.join('templates', name)
with open(os.path.abspath(path), 'r') as fp:
return jinja2.Template(fp.read())
2016-07-07 14:49:23.475 19260 140246374881024 DEBUG app.py:136 log [-] Starting up
2016-07-07 14:49:23.513 19260 140246374881024 INFO chain.py:94 log [-] Registered plugin reader in position 0
2016-07-07 14:49:23.513 19260 140246374881024 INFO chain.py:94 log [-] Registered plugin aggregator in position 1
2016-07-07 14:49:23.513 19260 140246374881024 INFO chain.py:94 log [-] Registered plugin writer in position 2
2016-07-07 14:49:23.513 19260 140246374881024 INFO chain.py:94 log [-] Registered plugin exception_handler in position 3
2016-07-07 14:49:23.513 19260 140246374881024 INFO chain.py:111 log [-] Starting chain worker
2016-07-07 14:49:23.513 19260 140246374881024 INFO chain.py:100 log [-] Initializing chain worker
2016-07-07 14:49:23.513 19260 140246374881024 DEBUG db_connectors.py:27 log [-] PostgresWriter initialize
2016-07-07 14:49:23.517 19260 140246374881024 DEBUG chain.py:68 log [-] Validating chain integrity for chain worker
2016-07-07 14:49:23.517 19260 140246374881024 DEBUG pykafka_connectors.p
@jmvrbanac
jmvrbanac / Dockerfile
Created August 23, 2016 21:17
Example Dockerfile
FROM python:3.4
MAINTAINER Random Author <[email protected]>
# Update Python Container
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y vim
# Copy all project files and set as the working dir
COPY . /opt/app_name
WORKDIR /opt/app_name