Skip to content

Instantly share code, notes, and snippets.

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]
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 / 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
%matplotlib inline
from matplotlib import pyplot as plt
from IPython import display
display.set_matplotlib_formats('svg')
from matplotlib import style
style.use('ggplot')
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
@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
@olegantonyan
olegantonyan / pulse_simple_play.py
Created November 10, 2017 04:41 — forked from ignacysokolowski/pulse_simple_play.py
Python: Play a WAV file with PulseAudio simple API
#!/usr/bin/env python
import ctypes
import wave
import sys
pa = ctypes.cdll.LoadLibrary('libpulse-simple.so.0')
PA_STREAM_PLAYBACK = 1
PA_SAMPLE_S16LE = 3
@olegantonyan
olegantonyan / userContent.css
Created March 10, 2017 10:30
Firefox dark theme fix inputs
/* ~/.mozilla/firefox/XXXXXX.default/chrome/userContent.css */
input {
border: 2px inset white;
background-color: white;
color: black;
-moz-appearance: none !important;
}
textarea {
border: 2px inset white;
@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