vmstat -n 1 | gawk '{ print 100-int($(NF-2)); fflush(); }' | ttyplot
Author Archives: Vitalijus Ryzakovas
apt meilisearch ubuntu
echo "deb [trusted=yes] https://apt.fury.io/meilisearch/ /" | sudo tee /etc/apt/sources.list.d/meilisearch.list
apt update
apt install meilisearch-http
vim /etc/systemd/system/meilisearch.service
[Unit]
Description=MeiliSearch search engine
After=network.target
[Service]
ExecStart=/usr/bin/meilisearch --http-addr 0.0.0.0:7700 --env production --master-key pwd123
Restart=always
[Install]
WantedBy=multi-user.target
pass arguments to alias bash
some grep alias:
g(){ grep \$1 /tmp/some_data.txt | sort -k1 | awk ' {print \$1 ,\"\t\", \$3 }';}
some mkdir alias:
mkcd() { mkdir -p -- "$1" && cd -P -- "$1"; }
put to:
vim ~/.bash_alias
source ~/.bash_alias
awk print with tabs
awk {'print $5"\t"$1'}
tcpdump mysql traffic
tcpdump -i any port 3306
curl resolve
curl resolver:
curl --resolve example.com:80:127.0.0.1 http://example.com/
sponge install linux
apt-get install moreutils
parse error: Invalid numeric literal at line 1,
curl remove -i:
curl -X POST -H 'Content-type:application/json' -d @my_file https://192.168.100.100/api.php | jq .
hosts file per user
if you just need SSH shortcut:
vim ~/.ssh/config file
Host myhost
Hostname 192.168.100.12
ssh: connect to host port 22: connection timed out to null
ssh: connect to host 192.168.100.1 port 22: Connection timed out
ssh 192.168.100.1 hostname 2>/dev/null
bash do not create file if empty result
tee empty file
use ifne
grep -ri website /etc/apache2 | ifne tee /tmp/outout.log
rm also can help:
grep -ri website /etc/apache2 > /tmp/outout.log ; [[ $? -ne 0 ]] && 'rm' -f /tmp/outout.log
varnish systemd 80 port
mkdir /etc/systemd/system/varnish.service.d
vim /etc/systemd/system/varnish.service.d/varnishd.conf
[Service]
ExecStart=
ExecStart=/usr/sbin/varnishd -j unix,user=vcache -F -a :80 -T 127.0.0.1:8081 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m
systemctl daemon-reload && systemctl start varnish
install keepalive 2 ubuntu
add-apt-repository ppa:hnakamur/keepalived
upstream repository: https://github.com/acassen/keepalived
deb source repository: https://github.com/hnakamur/keepalived-deb
More info: https://launchpad.net/~hnakamur/+archive/ubuntu/keepalived
Press [ENTER] to continue or ctrl-c to cancel adding it
gpg: keyring `/tmp/tmprfmnb5nq/secring.gpg' created
gpg: keyring `/tmp/tmprfmnb5nq/pubring.gpg' created
gpg: requesting key 1017341E from hkp server keyserver.ubuntu.com
gpg: /tmp/tmprfmnb5nq/trustdb.gpg: trustdb created
gpg: key 1017341E: public key "Launchpad PPA for Hiroaki Nakamura" imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
OK
server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
mv -v /usr/share/ca-certificates/mozilla/DST_Root_CA_X3.crt /tmp/
'/usr/share/ca-certificates/mozilla/DST_Root_CA_X3.crt' -> '/tmp/DST_Root_CA_X3.crt'
update-ca-certificates
Updating certificates in /etc/ssl/certs...
W: /usr/share/ca-certificates/mozilla/DST_Root_CA_X3.crt not found, but listed in /etc/ca-certificates.conf.
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.
apt update
sed leave only 1000 last lines
instead sed use tail:
tail -n 1000 file.log | sponge file.log