Skip to content

Instantly share code, notes, and snippets.

@riblo
riblo / PVE-KVM_img-conv.txt
Last active November 19, 2019 16:59
Proxmox/KVM images conversions
# qcow2 -> qcow2compress
qemu-img convert -O qcow2 -c vm-103-disk-0.qcow2 vm-103-disk-0-comp.qcow2
# lvm-thin -> qcow2
qemu-img convert -O qcow2 /dev/lvm-thin/vm-103-disk-1 vm-103-disk-1.qcow2
# lvm-thin -> qcow2compress oneline
qemu-img convert -O qcow2 -c $(pvesm path lvm-thin:vm-103-disk-1) vm-103-disk-1.qcow2
# qcow2 -> raw
@riblo
riblo / k8s_mon.sh
Created October 4, 2019 15:47
Kubernetes CLI cluster monitoring
#!/bin/bash
#
# "kubectl top nodes" based -> metric-servers or heapster needed
# possible CSV output w/o line 21
#
# output example:
# worker-1: 2 % ; 5 % memory
# worker-2: 10 % ; 86 % memory
# 2019/10/04,17.43.08,CPU & RAM,6%,45%
#
@riblo
riblo / firewall_stop.sh
Created October 4, 2019 15:57
Disable linux firewall: Disable firewalld and iptables rules and chains
#!/bin/bash
# stop and disable fwd 4 systemd linux host
systemctl stop firewalld
systemctl disable firewalld
# accept, flush and delete all iptables rules and chains
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
@riblo
riblo / xvnc_account_gen.sh
Created October 4, 2019 16:10
VNC multi-user/multiple access generator
#!/bin/bash
# VNC multi-user/multiple access generator
# CentOS-7 tested
# account: user-1:user-1, user-2_user-2, etc
#useradd/passwd loop
for i in {1..5}; do useradd user-$i; done;
for i in {1..5}; do echo user-$i | passwd user-$i --stdin; done;
# xvnc configurations
lsblk
fdisk /dev/sde
fdisk /dev/sdf
mkfs.ext4 /dev/sde1
mkfs.ext4 /dev/sdf1
reboot
lsblk
vgdisplay
pvcreate /dev/sde1
vgextend pve /dev/sde1
# power server off
racadm serveraction powerdown
# power server on
racadm serveraction powerup
# perform server power cycle
racadm serveraction powercycle
# force hard server power reset
@riblo
riblo / dellemc_change_power_state.yml
Last active December 9, 2019 15:16
Ansible task to configure the Power State on the PowerEdge Servers
---
- hosts: hosts
connection: local
name: Configure Server Power Setting
gather_facts: False
tasks:
- name: Configure Server Power Setting
dellemc_change_power_state:
idrac_ip: "{{ idrac_ip }}"
@riblo
riblo / ovf2kvm.sh
Last active March 15, 2024 18:47
Import VMware images (ovf based) to Proxmox VE
#!/bin/bash
# Script that import VMware images (ovf based) to Proxmox VE
# Your VM_NAME needs to be the same for: VM_NAME (directory) and VM_NAME.ovf
PROXMOX_USER=root
PROXMOX_PASS=ch4ng3m3!
PROXMOX_HOST=1.2.3.4
PROXMOX_PORT=22
PROXMOX_STORAGE=local-lvm
VM_PATH=/mnt/hgfs/shared/VM-Backup/
@riblo
riblo / rm_history.sh
Created November 27, 2019 09:58
Remove history oneline
rm -f $HISTFILE && unset HISTFILE && exit
@riblo
riblo / vmx2ovf.bat
Last active November 27, 2019 10:12
Windows 10 - vmx2ovf oneline converter
ovftool.exe "C:\Your\Path\metasploitable-linux-2.0.0\Metasploitable2-Linux\Metasploitable.vmx" "C:\Your\Path\metasploitable\metasploitable.ovf"