Skip to content

Instantly share code, notes, and snippets.

@metajiji
metajiji / nsenter.sh
Created April 19, 2023 15:58
k8s nsenter script
#!/bin/sh
node=${1}
kube_context=${2:-""}
nodeName=$(kubectl ${kube_context:+--context $kube_context} get node "$node" -o template --template='{{index .metadata.labels "kubernetes.io/hostname"}}')
nodeSelector='"nodeSelector": { "kubernetes.io/hostname": "'${nodeName:?}'" },'
podName=$USER-nsenter-$node
kubectl ${kube_context:+--context $kube_context} run "${podName:?}" --restart=Never -it --rm --image overriden --overrides '
{
@ECHO OFF
:: Значения по умолчанию :::::::::::::::::::::::::::
SET TCP_WINDOW=64k
SET TARGET_IP=127.0.0.1
SET TARGET_PROTO=tcp
::::::::::::::::::::::::::::::::::::::::::::::::::::
:: https://ritchielawrence.github.io/mtee/
@metajiji
metajiji / generate_ca.sh
Created December 3, 2019 13:12
self signed certificates
#!/bin/sh
#
# Required OpenSSL 1.1.1, providing subjectAltName directly on command line:
# https://security.stackexchange.com/questions/74345/provide-subjectaltname-to-openssl-directly-on-the-command-line
#
openssl req -x509 \
-nodes \
-subj "/CN=$1" \
@metajiji
metajiji / powerdns_to_ansible.py
Created August 24, 2019 14:19
Powerdns database to ansible vars
import sqlite3
import yaml
def dict_factory(cursor, row):
d = {}
for idx, col in enumerate(cursor.description):
d[col[0]] = row[idx]
return d
@metajiji
metajiji / install-megacli.md
Last active November 6, 2024 16:04 — forked from fxkraus/debian-install-megacli.md
Install LSI MegaCli

download

wget https://docs.broadcom.com/docs-and-downloads/raid-controllers/raid-controllers-common-files/8-07-14_MegaCLI.zip

or

curl -LO https://docs.broadcom.com/docs-and-downloads/raid-controllers/raid-controllers-common-files/8-07-14_MegaCLI.zip
  1. Install OS requirements:
yum install -y openssl-devel gcc apr-devel
  1. Check java version:
# /opt/atlassian/jira/jre/bin/java -version
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
@metajiji
metajiji / speedtest.sh
Last active January 4, 2021 08:31
speedtest oneliner
curl -sL https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | (python2 || python3 || python2)
@metajiji
metajiji / README.md
Created March 23, 2019 18:52
nspawn or docker containers reboot host

systemd 231-4

Reboot host-system from container:

[root@box ~]# echo b > /proc/sysrq-trigger 

Other things m - Will dump current memory info to your console.

@metajiji
metajiji / ANSIBLE_COW_PATH.sh
Last active March 21, 2019 18:19
lolcat wrap cowsay
#!/bin/sh
cowsay $@ | lolcat -f

for e in $(seq 0 1000); do sh -c "exit $e"; echo $e:$?; done