Skip to content

Instantly share code, notes, and snippets.

View nuBacuk's full-sized avatar
🍺
I may be slow to respond.

Ilia Khramtsov nuBacuk

🍺
I may be slow to respond.
View GitHub Profile
@nuBacuk
nuBacuk / .zshrc
Created April 7, 2021 22:11
zsh autocompletion
h=()
if [[ -r ~/.ssh/config ]]; then
h=($h ${${${(@M)${(f)"$(cat ~/.ssh/config)"}:#Host *}#Host }:#*[*?]*})
fi
if [[ -r ~/.ssh/known_hosts ]]; then
h=($h ${${${(f)"$(cat ~/.ssh/known_hosts{,2} || true)"}%%\ *}%%,*}) 2>/dev/null
fi
if [[ $#h -gt 0 ]]; then
zstyle ':completion:*:ssh:*' hosts $h
zstyle ':completion:*:slogin:*' hosts $h
@nuBacuk
nuBacuk / policy.json
Last active February 20, 2021 18:22
aws s3 read,write,list policy
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"s3:ListMultipartUploadParts",
"s3:PutObject",
"s3:GetObject",
@nuBacuk
nuBacuk / bashrc
Last active July 17, 2020 10:44
bash ssh autocomplete
file: ~/.bashrc
. /etc/bash_completion.d/ssh
juju bootstrap maas maas-controller
juju build
juju deploy /tmp/charm-builds/wordpress --constraints mem=2G
juju upgrade-charm wordpress --path /tmp/charm-builds/wordpress
juju deploy mysql --series xenial --constraints mem=2G
juju add-relation wordpress mysql
watch -c juju status --color
sqlplus system/oracle <<+EOF
DECLARE
CURSOR get_session IS SELECT sid,serial# FROM v\$session WHERE username = 'FASTGATE';
BEGIN
FOR loop_session IN get_session
LOOP
dbms_output.Put_line(loop_session.sid);
dbms_output.Put_line(loop_session.serial#);
EXECUTE IMMEDIATE 'alter system kill session ''' || loop_session.sid || ',' || loop_session.serial# || '''';
END LOOP;
@nuBacuk
nuBacuk / juju-azura.md
Last active March 31, 2020 13:54
juju azura
@nuBacuk
nuBacuk / colorize the terminal zsh macos
Last active March 27, 2020 10:12
colorize the terminal zsh macos
brew tap sambadevi/powerlevel9k
brew install powerlevel9k
echo "source /usr/local/opt/powerlevel9k/powerlevel9k.zsh-theme" >> ~/.zshrc
https://github.com/powerline/fonts/blob/master/SourceCodePro/Source%20Code%20Pro%20for%20Powerline.otf
@nuBacuk
nuBacuk / upgrade-kubeadm.md
Last active September 19, 2019 13:19
upgrade-kubeadm.md
kubeadm upgrade plan  1.16.0 --config kubeadm-config.yaml
kubeadm upgrade apply -y 1.16.0 --config kubeadm-config.yaml --ignore-preflight-errors=all --force

Вывод команды

@nuBacuk
nuBacuk / etcd.md
Last active September 18, 2019 11:24
Commands ETCD
ETCDCTL_API=3 etcdctl --endpoints=https://172.27.10.136:2379,https://172.27.10.137:2379,https://172.27.10.138:2379 --cacert /etc/kubernetes/pki/etcd/ca.crt --cert /etc/kubernetes/pki/etcd/peer.crt --key /etc/kubernetes/pki/etcd/peer.ke
y endpoint status -w table

+----------------------------+------------------+---------+---------+-----------+-----------+------------+
|          ENDPOINT          |        ID        | VERSION | DB SIZE | IS LEADER | RAFT TERM | RAFT INDEX |
+----------------------------+------------------+---------+---------+-----------+-----------+------------+
| https://172.27.10.136:2379 | fd6543c20e28d267 |  3.3.10 |  4.5 MB |      true |      3983 |    3041667 |
| https://172.27.10.137:2379 | 9d230288279f239e |  3.3.10 |  4.4 MB |     false |      3983 |    3041667 |
| https://172.27.10.138:2379 | 50d8b1b2d2933be | 3.3.10 | 4.4 MB | false | 3983 | 3041666 |
@nuBacuk
nuBacuk / postgres-sizw.md
Last active August 12, 2019 10:44
Postgres размер таблиц и баз данных

Размер таблиц:

SELECT 
schemaname||'.'||tablename AS full_tname, 
pg_size_pretty(pg_total_relation_size(schemaname||'.'||tablename)) AS total_usage, 
pg_size_pretty((pg_total_relation_size(schemaname||'.'||tablename) - pg_relation_size(schemaname||'.'||tablename))) AS external_table_usage 
FROM pg_catalog.pg_tables 
ORDER BY pg_total_relation_size(schemaname||'.'||tablename) DESC;

Размер базы: