This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# usage: ./find_if_by_mac.sh d4:3a:65:08:13:7e | |
function get_if_name() { | |
name=`echo "$1" | awk '{print $2}' | sed 's/:$//'` | |
echo $name | |
} | |
mac=$1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Calculate data statistics, including pencentile, min, max, average, standard deviation. | |
# Derived from https://gist.github.com/lewisd32/4be2605400acf0bb562d | |
# | |
# Usage & Output | |
# $ cat nums.txt | ./stats.sh | |
# total 100 | |
# p50 49 | |
# p90 89 | |
# p95 94 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.utils.deprecation import MiddlewareMixin | |
class ViewProfilerMiddleware(MiddlewareMixin): | |
def process_request(self, request): | |
self._pr = cProfile.Profile() | |
self._pr.enable() | |
def process_response(self, request, response): | |
self._pr.disable() |