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
#!/usr/bin/env ruby | |
require "openssl" | |
class BF < Struct.new(:key, :pad_with_spaces) | |
def encrypt(str) | |
cipher = OpenSSL::Cipher.new('bf-ecb').encrypt | |
if pad_with_spaces | |
str += " " until str.bytesize % 8 == 0 | |
cipher.padding = 0 |
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
# Access number | |
cat production.log | grep "^Processing" | wc | awk '{print $1}' | |
# Each IP access number | |
cat production.log | grep “^Processing” | awk ‘{print $4}’ | uniq -c | |
# Independent IP number | |
cat production.log | grep "^Processing" | awk '{print $4}' | uniq | wc | awk '{print $1}' | |
cat production.log | grep “^Processing” | awk ‘{print $4}’ | uniq | wc -l |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
# Helper function to plot a decision boundary. | |
# If you don't fully understand this function don't worry, it just generates the contour plot below. | |
def plot_decision_boundary(pred_func): | |
# Set min and max values and give it some padding | |
x_min, x_max = X[:, 0].min() - .5, X[:, 0].max() + .5 | |
y_min, y_max = X[:, 1].min() - .5, X[:, 1].max() + .5 | |
h = 0.01 | |
# Generate a grid of points with distance h between them | |
xx, yy = np.meshgrid(np.arange(x_min, x_max, h), np.arange(y_min, y_max, h)) | |
# Predict the function value for the whole gid |