On your locust master server:
Use logra.py on your locust test file. See locustfile.py.
| # Simple Objective-C Makefile | |
| bin = prog | |
| CFLAGS = -Wno-import -Wall -O2 | |
| LDFLAGS = -lobjc -lm | |
| src := $(wildcard *.m) | |
| objects := $(foreach file, $(src), $(basename $(file)).o) |
| package netutil | |
| import ( | |
| "encoding/json" | |
| "io/ioutil" | |
| "net/http" | |
| ) | |
| func GetURLContents(url string) (contents []byte, err error) { | |
| resp, err := http.Get(url) |
| import urllib, urllib2 | |
| import xml.etree.ElementTree as ET | |
| from django.conf import settings | |
| class PagSeguro(): | |
| def pagamento(self, item_id, item_descr, item_value): | |
| pagseguro_url = 'https://ws.pagseguro.uol.com.br/v2/checkout/' | |
| pagseguro_email = settings.PAGSEGURO_EMAIL | |
| pagseguro_token = settings.PAGSEGURO_TOKEN |
| diff --git a/themes/pure/pure.theme.bash b/themes/pure/pure.theme.bash | |
| index 9b145cc..c25c484 100644 | |
| --- a/themes/pure/pure.theme.bash | |
| +++ b/themes/pure/pure.theme.bash | |
| @@ -30,12 +30,13 @@ pure_prompt() { | |
| ps_root="${red}\u${red}"; | |
| ps_root_mark="${red} # ${normal}" | |
| ps_path="${yellow}\w${normal}"; | |
| + ps_env="$(virtualenv_prompt)${normal}" | |
| import sys | |
| import subprocess | |
| import smtplib | |
| from email.mime.text import MIMEText | |
| from threading import Thread | |
| FROM = "" | |
| TO = "" | |
| SMTP_SERVER = "localhost" |
| #include <sys/klog.h> | |
| #include <stdlib.h> | |
| #include <unistd.h> | |
| int main(void) { | |
| int logsize = klogctl(10 /* SYSLOG_ACTION_SIZE_BUFFER */, 0, 0); | |
| char *bufp = malloc(logsize); | |
| klogctl(3 /* SYSLOG_ACTION_READ_ALL */, bufp, logsize); | |
| write(1, bufp, logsize); |
| From: https://www.youtube.com/watch?v=BHhA_ZKjyxo | |
| # session management | |
| tmux ls (or tmux list-sessions) | |
| tmux new -s session-name | |
| Ctrl-b d Detach from session | |
| tmux attach -t [session name] | |
| tmux kill-session -t session-name | |
| # Helper class for statistics | |
| # see: http://www.johndcook.com/blog/standard_deviation/ | |
| class Stats: | |
| """ Uses Welford's method to calculate stats. | |
| Assumes positive values. | |
| It's not thread safe | |
| stats = Stats("ConnectionTimeStats") | |
| stats.add(0.223) | |
| stats.add(1.343) |
| import time | |
| # Simple Timer | |
| class Timer: | |
| def __init__(self): | |
| self.reset() | |
| def reset(self): | |
| self._start = time.time() | |
| def elapsed(self): # elapsed time in seconds (float) |