#F3E3CD,#F3E3CD,#F3951D,#DA3D61,#F26328,#183E1C,#DA3D61,#F26328
#222222,#2F2F2F,#F92772,#FFFFFF,#A6E22D,#FFFFFF,#66D9EF,#BE84F2
#86A34E,#94AF63,#FFFFFF,#6D8B42,#94AF63,#FFFFFF,#FFB10A,#DFA044
#!/usr/bin/env python3 | |
from bs4 import BeautifulSoup | |
import dateparser | |
import csv | |
soup = BeautifulSoup(open('WeightRecorder - 2016-09-18.xml'), "lxml") | |
def kgtolbs(kg): | |
return float(kg) * 2.20462262185 |
#!/bin/bash | |
grep -A10000000 ListenHTTPS /etc/pound/pound.cfg \ | |
| sed -n "s/^.*HeadRequire\s*\"Host\:\.\*\(.*\)\.\*.*$/\1/p" \ | |
> domains.txt |
# MIT License | |
# Copyright (c) 2016 Chandler Abraham | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: |
"""Plots a Pandas dataframe as a heatmap""" | |
import matplotlib as mpl | |
import matplotlib.pyplot as plt | |
def heatmap(df, | |
edgecolors='w', | |
cmap=mpl.cm.RdBu, | |
log=False,vmin=0,vmax=500): | |
width = len(df.columns)/4 | |
height = len(df.index)/4 |
from typing import Iterable, Callable, List | |
def ordered_set(iterable: Iterable, key: Callable=lambda x: x) -> List: | |
""" | |
Returns a new list containing all unique items from the iterable. A custom key function can | |
be specified to customize the uniqueness constraint, for example to return the first unique | |
element from the input list based on the second item in each element, one could pass | |
`lambda x: x[1]`. | |
""" | |
out_list = [] |
COST_GB_SEC = 0.00001667 | |
cost = 0 | |
with open('logs.log', 'r') as f: | |
logs = f.readlines() | |
billing = [i.split('\t') for i in logs if '\tBilled Duration:' in i] | |
for i in billing: | |
gb = float(i[3].lstrip('Memory Size: ').rstrip(' MB')) / 1024 | |
sec = float(i[2].lstrip('Billed Duration: ').rstrip(' ms ')) / 1000 |
# -*- coding: utf-8 -*- | |
# -*- mode: python -*- | |
# Adapted from mpl_toolkits.axes_grid1 | |
# LICENSE: Python Software Foundation (http://docs.python.org/license.html) | |
from matplotlib.offsetbox import AnchoredOffsetbox | |
class AnchoredScaleBar(AnchoredOffsetbox): | |
def __init__(self, transform, sizex=0, sizey=0, labelx=None, labely=None, loc=4, | |
pad=0.1, borderpad=0.1, sep=2, prop=None, barcolor="black", barwidth=None, | |
**kwargs): |
from __future__ import division | |
import numpy as np | |
import scipy.stats.kde as kde | |
def hpd_grid(sample, alpha=0.05, roundto=2): | |
"""Calculate highest posterior density (HPD) of array for given alpha. | |
The HPD is the minimum width Bayesian credible interval (BCI). | |
The function works for multimodal distributions, returning more than one mode | |
Parameters |
#!/usr/bin/env python3 | |
# based on https://github.com/cherrypy/cherrypy/blob/0857fa81eb0ab647c7b59a019338bab057f7748b/cherrypy/process/wspbus.py#L305 | |
import sys | |
import os | |
import time | |
_startup_cwd = os.getcwd() | |
def _do_execv(): | |
args = sys.argv[:] |