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
grep " 404 " * | cut -d " " -f 7 | sort | uniq -c | sort -n -r | head -50 | less | |
On hhtpd access log directory |
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
module Italian | |
# Generates a random fiscal code | |
class << self | |
@@generated_cfs = [] | |
def cf | |
res = [] | |
# ^[A-Z]{6} | |
res << _A_Z(6) |
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
"""""""""""""""""" | |
" Vundle options | |
""""""""""""""""" | |
set nocompatible " be iMproved, required | |
filetype off " required | |
:let mapleader = "-" " Maps - as leader character | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim |
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
# Base factorial version not tail recursive | |
def fact(n) | |
return 1 if n <= 1 | |
n * fact(n-1) | |
end | |
# enable tail recursive optimization | |
RubyVM::InstructionSequence.compile_option = { | |
tailcall_optimization: true, | |
trace_instruction: false |
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
ag 'DEPRECATION' log/development.log | awk -F 'DEPRECATION WARNING' '{print $2}' | sort -u |
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
data = [] | |
0.upto(2**(8*2)) do |i| | |
char = [i].pack("U*") | |
#puts "%04x" % i + ": " + char | |
data << char | |
end | |
p data, data.length |
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
class Node | |
attr_accessor :value, :next_node, :prev_node | |
def initialize(value, next_node = nil, prev_node = nil) | |
@value = value | |
@next_node = next_node | |
@prev_node = prev_node | |
end | |
end |
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
# Definition for a binary tree node. | |
# class TreeNode | |
# attr_accessor :val, :left, :right | |
# def initialize(val) | |
# @val = val | |
# @left, @right = nil, nil | |
# end | |
# end | |
# @param {TreeNode} root |
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
require 'matrix' | |
require 'ruby_linear_regression' | |
ROWS_PER_OPTION = 1_000 | |
POSITION_VALUES_MAPPING = { | |
top_left: { value: [1, 1], consent_rate: 60 }, | |
bottom_left: { value: [1000, 1], consent_rate: 30 }, | |
top_right: { value: [1, 1000], consent_rate: 45 }, | |
bottom_right: { value: [1000, 1000], consent_rate: 20 }, |
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
require 'webrick' | |
require 'webrick/httpproxy' | |
# How to test it | |
# | |
# In a terminal: | |
# $ ruby delay_proxy.rb | |
# | |
# In another terminal: | |
# $ http_proxy=http://localhost:8001 curl http://www.google.it |
OlderNewer