Some functions for helping timing stuff.
Note: The best timer is platform dependent. So always use from timeit import default_timer
.
Some functions for helping timing stuff.
Note: The best timer is platform dependent. So always use from timeit import default_timer
.
{ | |
"logging": { | |
"version": 1, | |
"disable_existing_loggers": true, | |
"formatters": { | |
"brief": { | |
"class": "logging.Formatter", | |
"datefmt": "%I:%M:%S", | |
"format": "%(levelname)-8s; %(name)-15s; %(message)s" | |
}, |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# author: Panagiotis Mavrogiorgos | |
# email: gmail, pmav99 | |
""" | |
A help class for generating bootstrap tables. | |
""" | |
from __future__ import division |
[Event "Let's Play!"] | |
[Site "Chess.com"] | |
[Date "2015.02.18"] | |
[Round "?"] | |
[White "pmav99"] | |
[Black "RedPawn81"] | |
[Result "*"] | |
[WhiteElo "1913"] | |
[BlackElo "1564"] | |
[TimeControl "1 in 5 days"] |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# author: Panagiotis Mavrogiorgos | |
# email: gmail, pmav99 | |
from __future__ import division | |
from __future__ import print_function | |
from __future__ import unicode_literals | |
from __future__ import absolute_import |
def nearly_equal(a, b, epsilon): | |
""" | |
Return `True` if the "difference" between `a` and `b` is smaller than `epsilon`, `False` otherwise. | |
This function tries to solve the problem of float comparison in a way that handles all cases | |
(i.e. comparing floats with `inf`, `nan` etc). | |
Do take note that when the difference between `a` and `b` is "equal" to `epsilon` then the | |
results may not be what you expect them to be... For example:: | |
a = 1 | |
b = a + 1e-7 | |
epsilon = 1e-7 |
def von_mises(S11, S22, S12, fc, ft): | |
""" | |
Returns the type of failure according to the modified Von Mises | |
failure criterion. | |
Input | |
----- | |
S11 : float | |
Normal stresses (σx) | |
S22 : float |
Tested under zsh
, should work under bash
too.
Install virtualenv
& virtualenvwrapper
. Depends on the distribution.
Put in .zshrc
(.bashrc
if you use bash
):
# Virtualenvs
if which virtualenvwrapper.sh &> /dev/null; then
mkdir -p $HOME/Prog
export WORKON_HOME=$HOME/.virtualenvs
.PHONY: list | |
list: | |
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | xargs |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# module: circle_ci_example.py | |
# author: Panagiotis Mavrogiorgos (pmav99) | |
""" | |
An example of using Circle-CI's REST API using hammock. | |
For more info on how to use hammock check the documentation: | |
https://github.com/kadirpekel/hammock |