NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.
If you are not into long explanations, see [Paolo Bergantino’s answer][2].
git config --global http.proxy 'socks5://127.0.0.1:1080' | |
git config --global https.proxy 'socks5://127.0.0.1:1080' |
#import section | |
from matplotlib import pylab | |
import pylab as plt | |
import numpy as np | |
#sigmoid = lambda x: 1 / (1 + np.exp(-x)) | |
def sigmoid(x): | |
return (1 / (1 + np.exp(-x))) | |
mySamples = [] |
import tensorflow as tf | |
from tensorflow.keras.layers import Layer | |
class ROIPoolingLayer(Layer): | |
""" Implements Region Of Interest Max Pooling | |
for channel-first images and relative bounding box coordinates | |
# Constructor parameters | |
pooled_height, pooled_width (int) -- | |
specify height and width of layer outputs |
NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.
If you are not into long explanations, see [Paolo Bergantino’s answer][2].
exports.stripComments = function stripComments(toBeStrippedStr){ | |
//LEXER | |
function Lexer () { | |
this.setIndex = false; | |
this.useNew = false; | |
for (var i = 0; i < arguments.length; ++i) { | |
var arg = arguments [i]; | |
if (arg === Lexer.USE_NEW) { | |
this.useNew = true; | |
} |
tmux is a "terminal multiplexer", it enables a number of terminals to be accessed and controlled from a single terminal. | |
If you use Debian/Ubuntu, you can just run apt-get install tmux, and voila. | |
Since the title was about centos 7, then do the following step to install tmux. | |
(1). tmux has a library dependency on libevent which, of course, isn’t installed by default. | |
$ wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz | |
$ tar xzvf libevent-2.0.21-stable.tar.gz | |
$ cd libevent-2.0.21-stable |
The script run-and-stop-gunicorn.sh takes 1 second on both Python 2.7 and 3.4. | |
$ cat /etc/lsb-release | |
DISTRIB_ID=Ubuntu | |
DISTRIB_RELEASE=14.04 | |
DISTRIB_CODENAME=trusty | |
DISTRIB_DESCRIPTION="Ubuntu 14.04.2 LTS" | |
$ | |
$ | |
$ source 27-env/bin/activate |
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
#!/usr/bin/env python | |
# | |
# Simple script showing how to read a mitmproxy dump file | |
# | |
### UPD: this feature is now avaiable in mitmproxy: https://github.com/mitmproxy/mitmproxy/pull/619 | |
from libmproxy import flow | |
import json, sys |
#!/usr/bin/env python | |
import binascii, sys, json | |
import version, tnetstring, flow | |
from datetime import datetime | |
def create_har(flows): | |
return { | |
"log":{ |