Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am mcos on github.
  • I am mcos (https://keybase.io/mcos) on keybase.
  • I have a public key ASDhFkDvIIMc8TDgtJq1nolHX2sVttNcFQTTGBU88cXUNgo

To claim this, I am signing this object:

@mcos
mcos / generate_token.go
Created March 27, 2015 14:37
Generate a 128 character random string in Go
package main
import (
"crypto/rand"
"fmt"
)
func randStr(strSize int) string {
dictionary := "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
@mcos
mcos / bare_install.sh
Last active August 29, 2015 14:01
Bare Pi Install
#!/bin/sh
# Copyright 2014 Robin Powered Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
#!/bin/sh
# Copyright 2014 Robin Powered Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
@mcos
mcos / install.sh
Last active August 29, 2015 13:57
Script to download and install the https://github.com/robinpowered/bifrost package onto a raspberry pi.
#!/bin/sh
# Copyright 2014 Robin Powered Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
@mcos
mcos / es.sh
Created August 2, 2013 14:29 — forked from rajraj/es.sh
cd ~
sudo yum update
sudo yum install java-1.7.0-openjdk.i686 -y
wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.19.9.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
mv elasticsearch-* elasticsearch
sudo mv elasticsearch /usr/local/share
#!/bin/bash
# Script used to setup elasticsearch. Can be run as a regular user (needs sudo)
ES_USER="elasticsearch"
ES_GROUP="$ES_USER"
ES_HOME="/usr/local/share/elasticsearch"
ES_CLUSTER="clustername"
ES_DATA_PATH="/var/data/elasticsearch"
ES_LOG_PATH="/var/log/elasticsearch"
ES_HEAP_SIZE=1024
@mcos
mcos / http_base.py
Last active December 10, 2015 08:38
Skeleton Base Class for Python HTTP Operations
class HttpBase(object):
def __init__(self, base_url, api_key):
self.base_url=base_url
self.api_key=api_key
self.headers = {'Content-Type': 'application/json',
'Accepts': 'application/json'}
self.http = httplib2.Http()
def get(self, path, data=None):