Skip to content

Instantly share code, notes, and snippets.

View BrianHicks's full-sized avatar

Brian Hicks BrianHicks

View GitHub Profile
<h1>Hello!</h1>
== <%= @test %> ==
@BrianHicks
BrianHicks / cpython.py
Created December 18, 2014 14:05
averages
Python 2.7.8 (default, Nov 14 2014, 15:57:55)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.54)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> def avg1(nums):
... return sum(nums) / float(len(nums))
...
>>> def avg2(nums):
... count, tot = 0, 0
... for num in nums:
... count += 1
>>> def ints1(lst):
... return [int(x) for x in lst if x.isdigit()]
...
>>> def ints2(lst):
... out = []
... for item in lst:
... try:
... out.append(int(item))
... except ValueError:
... pass
# -*- encoding: utf-8 -*-
import hashlib
import itertools
import os
class BlobStore(dict):
def identify(self, blob):
return 'sha1-%s' % hashlib.sha1(blob).hexdigest()
# Description:
# Control marathon via hubot
#
# Configuration:
# HUBOT_MARATHON_HOST=marathon.yourcompany.com:8080
#
# Commands:
# hubot marathon - show the instances of all apps
# hubot marathon <id> - show the number of instances for app <id>
# hubot scale <id> <number> - scale app ID to <number> instances
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
import json
from multiprocessing import Pool, Queue
import random
import requests
from requests.packages.urllib3.exceptions import ProtocolError
import sys
import time
from timeit import timeit
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
[
{
"children": [],
"name": "a task @done",
"tags": {
"done": null
}
},
{
"children": [
alias wheel_add="pip wheel --wheel-dir=$HOME/wheelhouse"
alias wheel_install="pip install --use-wheel --no-index --find-links=$HOME/wheelhouse"
@BrianHicks
BrianHicks / user-data
Created April 30, 2014 15:28
cloud config sample
#cloud-config
coreos:
etcd:
#discovery: https://discovery.etcd.io/203df1b81a502546048a45336d7d669b
addr: $public_ipv4:4001
peer-addr: $public_ipv4:7001
units:
- name: etcd.service
command: start