Skip to content

Instantly share code, notes, and snippets.

%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"}}}}}
@olegantonyan
olegantonyan / ctlr+s (cmd+s) save all in atom
Last active January 16, 2022 15:32
Atom save all shortcut
'.workspace, .workspace, .editor, .text-editor':
'cmd-s': 'window:save-all' # ctrl-s for Linux/Windows
@olegantonyan
olegantonyan / audio_volume_normalize.rb
Created May 25, 2016 06:58
Normalize audio volume using ffmpeg and ruby
def normalize_volume(file)
output = `ffmpeg -i '#{file}' -af "volumedetect" -f null /dev/null 2>&1`
raise "Error getting audio volume from #{file} (#{$?})" unless $?.success?
max_volume = output.scan(/max_volume: ([\-\d\.]+) dB/).flatten.first
mean_volume = output.scan(/mean_volume: ([\-\d\.]+) dB/).flatten.first
return if !max_volume || !mean_volume
max_volume = max_volume.to_f
mean_volume = mean_volume.to_f
target_volume = -14.0
adjustment = target_volume - mean_volume
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
[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]