Skip to content

Instantly share code, notes, and snippets.

@olegantonyan
olegantonyan / gist:735848cb0f188410ca3863de718e7c53
Created August 13, 2018 07:16
ruby monotonic timer benchmark
def benchmark(what)
start = ::Process.clock_gettime(Process::CLOCK_MONOTONIC)
yield
finish = ::Process.clock_gettime(Process::CLOCK_MONOTONIC)
sap "#{what} took #{finish - start} seconds"
end
def benchmark(what)
start = ::Process.clock_gettime(Process::CLOCK_MONOTONIC)
yield
finish = ::Process.clock_gettime(Process::CLOCK_MONOTONIC)
puts "#{what} took #{finish - start} seconds"
end
%matplotlib inline
from matplotlib import pyplot as plt
from IPython import display
display.set_matplotlib_formats('svg')
from matplotlib import style
style.use('ggplot')
@olegantonyan
olegantonyan / ipython default styles
Last active January 19, 2019 07:53
ipython default styles
%matplotlib inline
%config InlineBackend.figure_format = 'svg'
import matplotlib.pyplot as plt
plt.style.use('ggplot')
import numpy as np
logstash_1 | [2019-08-23T23:17:02,778][WARN ][logstash.outputs.elasticsearch] Could not index event to Elasticsearch. {:status=>400, :action=>["index", {:_id=>nil, :_index=>"logstash", :_type=>"_doc", :routing=>nil}, #<LogStash::Event:0x38719c08>], :response=>{"index"=>{"_index"=>"logstash-2019.08.23-000007", "_type"=>"_doc", "_id"=>"3X_EwGwBGHFJvHqx3Ny1", "status"=>400, "error"=>{"type"=>"mapper_parsing_exception", "reason"=>"failed to parse field [service] of type [text] in document with id '3X_EwGwBGHFJvHqx3Ny1'. Preview of field's value: '{type=system}'", "caused_by"=>{"type"=>"illegal_state_exception", "reason"=>"Can't get text on a START_OBJECT at 1:12"}}}}}
[Interface]
Address = <...>
MTU = 1412
PrivateKey = <...>
DNS = <...>
PostUp = iptables -t nat -A POSTROUTING -o %i -j MASQUERADE; iptables -A FORWARD -i %i -m state --state RELATED,ESTABLISHED -j ACCEPT; iptables -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
PostDown = iptables -t nat -D POSTROUTING -o %i -j MASQUERADE; iptables -D FORWARD -i %i -m state --state RELATED,ESTABLISHED -j ACCEPT; iptables -D FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
[Peer]
echo 'deb http://zenbook:9000/1-mpz-debian-10 stable/' | sudo tee /etc/apt/sources.list.d/omnipackage_mpz.list
curl -fsSL http://zenbook:9000/1-mpz-debian-10/stable/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/omnipackage_mpz.gpg > /dev/null
apt update
apt install mpz
# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=10000000000
SAVEHIST=10000000000
bindkey -e
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
zstyle :compinstall filename '/home/oleg/.zshrc'
autoload -Uz compinit